swagger: "2.0"
schemes:
  - https
host: cenit.io
basePath: /api/v1
info:
  contact:
    email: support@cenit.io
    name: Cenit IO Support
    url: https://cenit.io
  description: |
    Cenit IO is an Open Platform for Data and Business Integration (iPaaS)
  termsOfService: https://cenit-portal.herokuapp.com/terms_of_service
  title: Cenit IO - REST API Specification
  version: v1
  x-logo:
    url: https://cenit.io/images/logo.png
  x-origin:
    - format: swagger
      url: https://cenit-io.github.io/openapi/swagger.json
      version: "2.0"
  x-providerName: cenit.io
externalDocs:
  url: https://github.com/cenit-io/openapi
consumes:
  - application/json
  - application/xml
produces:
  - application/json
securityDefinitions:
  X-User-Access-Key:
    in: header
    name: X-User-Access-Key
    type: apiKey
  X-User-Access-Token:
    in: header
    name: X-User-Access-Token
    type: apiKey
security:
  - X-User-Access-Key: []
    X-User-Access-Token: []
tags:
  - description: |
      The Cenit IO API is organized around REST. Cenit IO is an Open Platform for Data 
      and Business Integration (iPaaS) to process, storage and move data in connection 
      with Cloud or On-Premise services. 

      It has been designed to orchestrate data flows that may involve several kind of 
      endpoints (APIs, Datasets, EDI). It makes possible the automation of all operational 
      processes in a company, connecting between organization's on-premises infrastructure 
      and cloud provider services.
    name: Introduction
  - description: |
      When you sign up for an account, you are given your first API key.
      You can generate additional API keys, and delete API keys (as you may
      need to rotate your keys in the future). You authenticate to Cenit IO API 
      by providing your endpoint API keys and token in the header parameters into 
      request. You can have multiple API keys and token active at one time for 
      any endpoint.
    name: Authentication
  - description: |
      Connection are the representation of endpoint. 
    name: Connection
  - description: |
      Define a group of webhooks that can apply to several connections.       
    name: Connection Role
  - description: |
      Allow that objects flow through the hub. The creation of new objects 
      and/or changes in existing objects will result in events. These events 
      ultimately result in calls being made to various Flows in your endpoints.
    name: Data Event
  - description: |
      Schedulers are events triggered on a certain moment and can be optionally recurrent.
    name: Scheduler
  - description: |
      Define an HTTP Method and params.
    name: Webhook
  - description: |
      A translator defines a logic for data manipulation. Data manipulation can occurs in the following scenarios:
        - Importing outside data into Cenit
        - Updating data already stored in Cenit
        - Converting data already stored in Cenit
        - Exporting data outside Cenit
    name: Translator
  - description: |
      A flow defines how data is processed by the execution of one or more actions, if 
      the data is coming in to Cenit or going out of Cenit. Data processing involve:

        ₋ An execution trigger to start the data processing
        
        ₋ Data types
        
        ₋ Translators
        
        ₋ Connections & Webhooks
    name: Flow
  - description: |
      Define a data type is as simple as a JSON Schema http://json-schema.org
    name: Data Type
  - description: |+
      Define space of names to use across all the tenants    
       
    name: Namespace
paths:
  /setup/connection:
    get:
      description: Returns a list of connections you've previously created. The connections are returned in sorted order, with the most recent connection appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/connection"
            type: array
      summary: Returns a list of connections
      tags:
        - Connection
    post:
      description: Creates or updates the specified connection by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/connection"
      summary: Create or update a connection
      tags:
        - Connection
  "/setup/connection/{id}":
    delete:
      description: Permanently deletes a connection. It cannot be undone.
      parameters:
        - description: Connection ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete a connection
      tags:
        - Connection
    get:
      description: Retrieves the details of an existing connection. You need only supply the unique connection identifier that was returned upon connection creation.
      parameters:
        - description: Connection ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/connection"
        "404":
          description: Item not found
      summary: Retrieve an existing connection
      tags:
        - Connection
  /setup/connection_role:
    get:
      description: Returns a list of connection roles you've previously created. The connection roles are returned in sorted order, with the most recent connection role appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/connection_role"
            type: array
      summary: Returns a list of connection roles
      tags:
        - Connection Role
    post:
      description: Creates or updates the specified connection role by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/connection_role"
      summary: Create or update a connection role
      tags:
        - Connection Role
  "/setup/connection_role/{id}":
    delete:
      description: Deletes the specified connection role.
      parameters:
        - description: Connection role ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete a connection role.
      tags:
        - Connection Role
    get:
      description: Returns a connection role
      parameters:
        - description: Connection role ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/connection_role"
        "404":
          description: Item not found
      summary: Return a connection role
      tags:
        - Connection Role
  /setup/data_type/:
    get:
      description: Returns a list of data types you've previously created. The data types are returned in sorted order, with the most recent DataType appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/data_type"
            type: array
      summary: Returns a list of data types
      tags:
        - Data Type
    post:
      description: Creates or updates the specified data type by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/data_type"
      summary: Create or update a data type
      tags:
        - Data Type
  "/setup/data_type/{id}":
    delete:
      description: Deletes the specified data type.
      parameters:
        - description: data type ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete a data type
      tags:
        - Data Type
    get:
      description: Retrieves the details of an existing data type. You need only supply the unique data  type identifier that was returned upon DataType creation.
      parameters:
        - description: data type ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/data_type"
        "404":
          description: Item not found.
      summary: Retrieve a data type
      tags:
        - Data Type
  /setup/flow/:
    get:
      description: Returns a list of flows you've previously created. The flows are returned in sorted order, with the most recent flow appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/flow"
            type: array
      summary: Returns a list of flows
      tags:
        - Flow
    post:
      description: Creates or updates the specified flow. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/flow"
      summary: Create or update a flow
      tags:
        - Flow
  "/setup/flow/{id}":
    delete:
      description: Deletes the specified flow.
      parameters:
        - description: Flow ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete a flow.
      tags:
        - Flow
    get:
      description: Retrieves the details of an existing flow. You need only supply the unique flow identifier that was returned upon flow creation.
      parameters:
        - description: Flow ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/flow"
        "404":
          description: Item not found.
      summary: Retrieve an existing flow
      tags:
        - Flow
  /setup/namespace/:
    get:
      description: Returns a list of namespaces you've previously created. The namespaces are returned in sorted order, with the most recent namespace appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/namespace"
            type: array
      summary: Returns a list of namespaces
      tags:
        - Namespace
    post:
      description: Creates or updates the specified namespace. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/namespace"
      summary: Create or update a namespace
      tags:
        - Namespace
  "/setup/namespace/{id}":
    delete:
      description: Deletes the specified namespace.
      parameters:
        - description: Namespace ID.
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete a namespace
      tags:
        - Namespace
    get:
      description: Retrieves the details of an existing namespace. You need only supply the unique webhook namespace that was returned upon namespace creation.
      parameters:
        - description: Namespace ID.
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/namespace"
        "404":
          description: Item not found.
      summary: Retrieve an existing namespace
      tags:
        - Namespace
  /setup/observer/:
    get:
      description: Returns a list of events you've previously created. The events are returned in sorted order, with the most recent event appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/observer"
            type: array
      summary: Returns a list of events
      tags:
        - Data Event
    post:
      description: Creates or updates the specified event observer. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/observer"
      summary: Create or update an event
      tags:
        - Data Event
  "/setup/observer/{id}":
    delete:
      description: Deletes the specified event observer.
      parameters:
        - description: Observer ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete an event
      tags:
        - Data Event
    get:
      description: Retrieves the details of an existing event. You need only supply the unique event identifier that was returned upon event creation.
      parameters:
        - description: Observer ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/observer"
        "404":
          description: Item not found.
      summary: Retrieve an existing event
      tags:
        - Data Event
  /setup/scheduler/:
    get:
      description: Returns a list of schedulers you've previously created. The schedulers are returned in sorted order, with the most recent scheduler appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/scheduler"
            type: array
      summary: Returns a list of schedulers
      tags:
        - Scheduler
    post:
      description: Creates or updates the specified scheduler. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/scheduler"
      summary: Create or update an scheduler
      tags:
        - Scheduler
  "/setup/scheduler/{id}":
    delete:
      description: Deletes the specified scheduler.
      parameters:
        - description: Scheduler ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete an schedule
      tags:
        - Scheduler
    get:
      description: Retrieves the details of an existing scheduler. You need only supply the unique scheduler identifier that was returned upon scheduler creation.
      parameters:
        - description: Scheduler ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/scheduler"
        "404":
          description: Item not found.
      summary: Retrieve an existing schedule
      tags:
        - Scheduler
  /setup/schema/:
    get:
      description: Returns a list of schemas you've previously created. The schemas are returned in sorted order, with the most recent schema appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/schema"
            type: array
      summary: Returns a list of schemas
      tags:
        - Schema
    post:
      description: Creates or updates the specified schema. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/schema"
      summary: Create or update an schema
      tags:
        - Schema
  "/setup/schema/{id}":
    delete:
      description: Deletes the specified schema.
      parameters:
        - description: Schema ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete an schema.
      tags:
        - Schema
    get:
      description: Retrieves the details of an existing schema. You need only supply the unique schema identifier that was returned upon schema creation.
      parameters:
        - description: Schema ID
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/schema"
        "404":
          description: Item not found.
      summary: Retrieve an existing schema
      tags:
        - Schema
  /setup/translator/:
    get:
      description: Returns a list of translators you've previously created. The translators are returned in sorted order, with the most recent translator appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/translator"
            type: array
      summary: Returns a list of translators
      tags:
        - Translator
    post:
      description: Creates or updates the specified translator. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/translator"
      summary: Create or update a translator
      tags:
        - Translator
  "/setup/translator/{id}":
    delete:
      description: Deletes the specified translator.
      parameters:
        - description: Translator ID.
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete a translator
      tags:
        - Translator
    get:
      description: Retrieves the details of an existing translator. You need only supply the unique translator identifier that was returned upon translator creation.
      parameters:
        - description: Translator ID.
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/translator"
        "404":
          description: Item not found.
      summary: Retrieve an existing translator
      tags:
        - Translator
  /setup/webhook/:
    get:
      description: Returns a list of webhooks you've previously created. The webhooks are returned in sorted order, with the most recent webhook appearing first.
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: "#/definitions/webhook"
            type: array
      summary: Returns a list of webhooks
      tags:
        - Webhook
    post:
      description: Creates or updates the specified webhook. Any parameters not provided will be left unchanged.
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/webhook"
      summary: Create or update a webhook
      tags:
        - Webhook
  "/setup/webhook/{id}":
    delete:
      description: Deletes the specified webhook.
      parameters:
        - description: Webhook ID.
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
        "404":
          description: Item not found
      summary: Delete a webhook
      tags:
        - Webhook
    get:
      description: Retrieves the details of an existing webhook. You need only supply the unique webhook identifier that was returned upon webhook creation.
      parameters:
        - description: Webhook ID.
          in: path
          name: id
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/webhook"
        "404":
          description: Item not found.
      summary: Retrieve an existing webhook
      tags:
        - Webhook
definitions:
  connection:
    properties:
      headers:
        items:
          properties:
            key:
              type: string
            value:
              type: string
          type: object
        type: array
      id:
        type: string
      key:
        type: string
      name:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
      parameters:
        items:
          properties:
            key:
              type: string
            value:
              type: string
          type: object
        type: array
      token:
        type: string
      url:
        type: string
    type: object
  connection_role:
    properties:
      connection:
        items:
          $ref: "#/definitions/connection"
        type: array
      id:
        type: string
      name:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
      webhook:
        items:
          $ref: "#/definitions/webhook"
        type: array
    type: object
  data_type:
    properties:
      id:
        type: string
      model_schema:
        type: string
      name:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
      show_navigation_link:
        type: string
      slug:
        type: string
      title:
        type: string
      type:
        type: object
    type: object
  flow:
    properties:
      active:
        type: boolean
      connection_role:
        $ref: "#/definitions/connection_role"
      custom_data_type:
        $ref: "#/definitions/data_type"
      event:
        type: object
      id:
        type: string
      name:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
      notify_request:
        type: boolean
      notify_response:
        type: boolean
      response_translator:
        $ref: "#/definitions/translator"
      translator:
        $ref: "#/definitions/translator"
      webhook:
        $ref: "#/definitions/webhook"
    type: object
  namespace:
    properties:
      id:
        type: string
      name:
        type: string
      slug:
        type: string
    type: object
  observer:
    properties:
      data_type:
        $ref: "#/definitions/data_type"
      id:
        type: string
      name:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
      triggers:
        type: string
      type:
        type: object
    type: object
  scheduler:
    properties:
      activated:
        type: boolean
      expression:
        type: string
      id:
        type: string
      name:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
    type: object
  schema:
    properties:
      id:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
      schema:
        type: string
      uri:
        type: string
    type: object
  translator:
    properties:
      custom_data_type:
        $ref: "#/definitions/data_type"
      id:
        type: string
      name:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
      source_data_type:
        $ref: "#/definitions/data_type"
      style:
        enum:
          - Ruby
          - Liquid
          - xslt
        type: string
      target_data_type:
        $ref: "#/definitions/data_type"
      transformation:
        type: string
      type:
        enum:
          - Import
          - Export
          - Convert
          - Update
        type: string
    type: object
  webhook:
    properties:
      headers:
        items:
          properties:
            key:
              type: string
            value:
              type: string
          type: object
        type: array
      id:
        type: string
      name:
        type: string
      namespace:
        $ref: "#/definitions/namespace"
      parameters:
        items:
          properties:
            key:
              type: string
            value:
              type: string
          type: object
        type: array
      path:
        type: string
    type: object
