{
  "openapi": "3.0.1",
  "info": {
    "title": "Legacy Data Integration API",
    "description": "Download OpenAPI Specification: <a href='/APIs/dataIntegrationLegacyOpenAPISpec.json' target='_blank' download='dataIntegrationLegacyOpenapi.json'>Download</a> \n\n  API documentation for the Legacy Data Integration API (Soon to be deprecated).",
    "contact": {
      "name": "Customer Support",
      "url": "https://community.boomi.com/boomi_support",
      "email": "support@boomi.com"
    },
    "version": "1.0.0"    
  },
  "x-codeSamples": {
    "lang": [
      "Python"
    ]
  },
  "externalDocs": {
    "description": "Find out more about Data Integration.",
    "url": "https://help.boomi.com/docs/Atomsphere/Data_Integration/Data_Integration_Overview"
  },
  "security": [
    {
      "BearerToken": []
    }
  ],
  "tags": [
    {
      "name": "Connection Types and Properties.",
      "description": "Connection types are combined the valid properties and the id of the provider of connections. <br> Because connection is a dynamic entity in Data Integration, every connection # must # have a connection type, and the expects the right properties and values by every connection type. <br>\nFor example, a `klaviyo` connection type requires 2 properties: <br> <li>`username` <br> <li>`access_token` <br> <br>\nThat means, `klaviyo` connections expect for these 2 properties in order to work properly.<br> Providing invalid property to the connection, or missing required one, will raise an error. "
    },
    {
      "name": "Connection Management",
      "description": "Create new connections, update them and delete the connections you don't want anymore.",
      "externalDocs": {
        "description": "Find our more about setting new connection in Data Integration.",
        "url": "https://rivery.io/docs/create-a-connection"
      }
    },
    {
      "name": "Connection Key Files",
      "description": " Uploading and Creating new files for connections, in cases of certificate files or encrypted files needed. For example, when connecting the Google Cloud Platform (GCP) resources (BigQuery and GCS), there's a need to provide a `*.json` file; In SSH Tunnel, a `*.pem` file is also needed in most cases. "
    },
    {
      "name": "OAuth2 Connections",
      "description": " Oauth2 process initiation. In order to support OAuth2 connections, In order to create new connections OAuth2 method, there's a need to create OAuth2 request to the provider, and then get the credentials by callback. The OAuth2 response will provide a credentials response that will be pass to the connection used an OAuth2 request in the `credentials` key. In order to determine the OAuth2 connections in Data Integration, find the `oauth=true` segmentation in the connection type. "
    },
    {
      "name": "Run River",
      "description": " Run rivers, check the run status and get run messages from the platform. ",
      "externalDocs": {
        "description": "Find out more about running rivers process in our community.",
        "url": "https://community.rivery.io/t/call-a-river-to-run-externally-using-the-rivery-api"
      }
    },
    {
      "name": "Get River",
      "description": "Get River (or Rivers) and its properties."
    },
    {
      "name": "Sub Rivers Properties",
      "description": "Get the properties needed for every sub river, by `river_id`, or by `datasource_type`."
    },
    {
      "name": "Sub Rivers Columns",
      "description": "To manage sub rivers inside a river, there is a need to set first the column subset defined in each river for its sub rivers. That means, every sub river that is created/updated is compared to the valid sub river columns defined in the river.\n\nIf a sub river has more columns than the sub river columns defined, an error is raised. The list of the sub river valid columns for each datasource_type or river is based on the Sub River Properties request.\n\nSub rivers are based on the columns chosen in the the main sub rivers tables. Sub rivers table is composed of global columns per river, and a full or partial row of values by each sub river to fill. Every sub river values are validated by the data type, and the correct values that can be inserted to each column. \n\n For example:\n\nIn a parent klaviyo river, we can define columns from the list returned in Sub River Properties requests, and then set the right subset of columns in every river we want to use. \n\n scope: `river:list`"
    },
    {
      "name": "Sub Rivers Management",
      "description": " Sub Rivers Management. Create / Read / Update / Delete Sub-Rivers values. Each value is validated and checked by the correlated key name of the column. Invalid key names will throw an error."
    },
    {
      "name": "Activity Logs",
      "description": " Activities. Monitor the river's current and previous runs. Logs are also available to download for some of the river types. "
    },
    {
      "name": "Results",
      "description": " Results. Get preview results of your query. "
    }
  ],
  "x-tagGroups": [
    {
      "name": "Data Connectors",
      "tags": [
        "Datasource Types"
      ]
    },
    {
      "name": "Connections",
      "tags": [
        "Connection Types and Properties",
        "Connection Management",
        "Connection Key Files",
        "OAuth2 Connections",
        "Share Connection"
      ]
    },
    {
      "name": "Rivers Management",
      "tags": [
        "Get River",
        "Sub Rivers Properties",
        "Sub Rivers Columns",
        "Sub Rivers Management"
      ]
    },
    {
      "name": "Run Rivers",
      "tags": [
        "Run River",
        "Run Subriver"
      ]
    },
    {
      "name": "Activities",
      "tags": [
        "Activity Logs"
      ]
    },
    {
      "name": "Results",
      "tags": [
        "Create pull requests for results",
        "Get result id",
        "Get results"
      ]
    }
  ],
  "servers": [
    {
      "url": "https://console.rivery.io",
      "description": "Data Integration Console (US)"
    },
    {
      "url": "https://eu-west-1.console.rivery.io",
      "description": "Data Integration Console (EU)"
    }
  ],
  "components": {
    "schemas": {
      "TimeRangeObject": {
        "type": "object",
        "properties": {
          "time_range": {
            "type": "string",
            "enum": [
              "yesterday",
              "today",
              "last_30_days",
              "last_365_days",
              "last_7_days",
              "last_14_days",
              "last_21_days",
              "last_90_days",
              "week_to_date",
              "previous_week",
              "last_week",
              "last_3_weeks",
              "last_6_weeks",
              "last_9_weeks",
              "last_12_weeks",
              "previous_week_to_date",
              "month_to_date",
              "previous_month",
              "last_month",
              "last_2_months",
              "last_3_months",
              "previous_month_to_date",
              "last_24_months",
              "quarter_to_date",
              "previous_quarter",
              "year_to_date",
              "year_to_month",
              "previous_year"
            ]
          },
          "start_date": {
            "type": "string",
            "format": "datetime"
          },
          "end_date": {
            "type": "string",
            "format": "datetime"
          },
          "days_back": {
            "type": "number"
          }
        }
      },
      "RiverAllowedProperties": {
        "type": "object",
        "properties": {
          "datasource_id": {
            "type": "string",
            "example": "klaviyo"
          },
          "properties": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "description": "The property key to provide",
                  "example": "accounts"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "connectionId",
                    "string",
                    "list_of_objects",
                    "float",
                    "boolean",
                    "date",
                    "integer",
                    "timeRangeObject",
                    "list",
                    "object",
                    "list_of_strings"
                  ],
                  "description": "The type of the key to provide. For more info about non-regular type - plese refer the Schemas objects.",
                  "example": "timeRangeObject"
                },
                "default_value": {
                  "type": "string",
                  "example": 1
                },
                "description": {
                  "type": "string",
                  "example": "Please choose report"
                },
                "required": {
                  "type": "boolean",
                  "example": false
                },
                "json_schema": {
                  "type": "string",
                  "description": "a Json Schema for validation the type and the requirement of this property"
                },
                "dependencies": {
                  "type": "object",
                  "description": "The json schema validation language refers to the dependencies of this property"
                },
                "reports": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The reports this property is required for"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "An array of the valid options to provide in this property"
                }
              }
            }
          }
        }
      },
      "SubRiverSchema": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "The sub river id",
            "example": "5faa7bd17bedeb66f4c287c7",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "description": "The sub river name",
            "example": "My Subriver"
          },
          "description": {
            "type": "string",
            "description": "A sub river description",
            "example": "My Facebook clients sub river"
          },
          "cross_id": {
            "$ref": "#/components/schemas/CrossIdSchema",
            "readonly": true
          },
          "master_river_id": {
            "description": "The parent river cross id",
            "$ref": "#/components/schemas/RiverIdSchema",
            "readonly": true
          },
          "account": {
            "$ref": "#/components/schemas/AccountSchema",
            "readonly": true
          },
          "env_id": {
            "$ref": "#/components/schemas/EnvIdSchema",
            "readonly": true
          },
          "date_updated": {
            "$ref": "#/components/schemas/UpdateDatesSchema",
            "readonly": true
          },
          "date_inserted": {
            "$ref": "#/components/schemas/UpdateDatesSchema",
            "readonly": true
          },
          "updated_by": {
            "$ref": "#/components/schemas/UpdateBySchema",
            "readonly": true
          },
          "source": {
            "$ref": "#/components/schemas/SourceSubRiverSchema"
          },
          "target": {
            "$ref": "#/components/schemas/TargetSubRiverSchema"
          },
          "is_scheduled": {
            "type": "boolean",
            "description": "A flag indicated if the sub river is scheduled.",
            "example": true,
            "readOnly": false
          },
          "schedule": {
            "$ref": "#/components/schemas/ScheduleSchema"
          },
          "inherit_schedule": {
            "type": "boolean",
            "description": "A flag indicates if the sub river inherits its schedule properties from the river.",
            "example": true
          },
          "is_enabled": {
            "type": "boolean",
            "description": "A flag indicates if the sub river is in active state or not",
            "example": false
          }
        }
      },
      "PullRequestResponseSchema": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "object",
            "properties": {
              "$oid": "string",
              "description": "The pull request ID",
              "example": "5faa7bd17bedeb66f4c287c7",
              "readOnly": true
            }
          },
          "request_status": {
            "type": "string",
            "description": "The status of the pull request",
            "example": "W",
            "readOnly": true
          },
          "results": {
            "type": "list",
            "description": "The results. Applicable only for \"D\" status",
            "example": "results_id: 5faa7bd17bedeb66f4c287c7"
          }
        }
      },
      "resultsSchema": {
        "type": "object",
        "properties": {
          "compiled_query": {
            "type": "string",
            "description": "The compiled SQL query",
            "example": "SELECT * FROM TABLE",
            "readOnly": true
          },
          "results": {
            "type": "string",
            "description": "The results in a json format",
            "example": "{\"col_a\": 901, \"col_b\": \"John\"}",
            "readOnly": true
          }
        }
      },
      "River": {
        "required": [
          "river_id"
        ],
        "type": "object",
        "properties": {
          "river_id": {
            "type": "string",
            "description": "river identifier",
            "example": "5e5fbbc2567409482d8511cd"
          }
        }
      },
      "DatasourceIdSchema": {
        "type": "string",
        "description": "A valid datasource id in Data Integration."
      },
      "CrossIdSchema": {
        "type": "string",
        "description": "Cross ID is a referenced ID which crosses between environment and accounts. In this case, the id can be stay the same, but reference between environments and accounts in rivers/connections/logic rivers, etc...",
        "example": "5faa7bd17bedeb66f4c287c7",
        "readOnly": true
      },
      "RiverIdSchema": {
        "type": "string",
        "description": "The river cross id which the sub river is refered to. Every sub river can be reference only one river id.",
        "example": "5faa76e31e78e0001d61d7cf",
        "readOnly": true
      },
      "AccountSchema": {
        "type": "string",
        "description": "Data Integration account id.",
        "example": "56643e6770ec07e624d43351",
        "readOnly": true
      },
      "EnvIdSchema": {
        "type": "string",
        "description": "The object's environment id.",
        "example": "56643e6770ec07e624d43574",
        "readOnly": true
      },
      "DatasourceTypeSchema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "facebook ads"
          },
          "_id": {
            "type": "string",
            "description": "datasource type id",
            "example": "fb_ads"
          },
          "segment": {
            "type": "string",
            "description": "The \"segment\" of the datasource. Can be set to target, connection, source, etc.",
            "enum": [
              "connections",
              "source",
              "target"
            ]
          },
          "description": {
            "type": "string",
            "example": "Facebook Ads Graph API"
          },
          "section_id": {
            "type": "string",
            "example": "sec_marketing"
          },
          "status": {
            "type": "string",
            "example": "coming_soon",
            "enum": [
              "enabled",
              "coming_soon",
              "beta",
              "alpha"
            ],
            "description": "The data source status in the platform."
          },
          "connection_type": {
            "type": "string",
            "example": "fb",
            "description": "The connection type that this datasource is connected with"
          },
          "doc_url": {
            "type": "string",
            "example": "https://help.boomi.com/...",
            "description": "The connection of the datasource doc link"
          },
          "source_doc_url": {
            "type": "string",
            "example": "https://help.boomi.com/...",
            "description": "The datasource \"walkthrough\" doc link."
          }
        }
      },
      "UpdateDatesSchema": {
        "type": "string",
        "format": "date-time",
        "description": "The date for insert/update of the entity.",
        "example": "2020-01-04T12:45:34.234Z",
        "readOnly": true
      },
      "SubRiverColumnSchema": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "example": "target_table"
          },
          "scope": {
            "type": "string",
            "enum": [
              "source",
              "target"
            ]
          }
        }
      },
      "RunRiverSchema": {
        "type": "object",
        "properties": {
          "run_id": {
            "type": "string",
            "example": "5e473b95567f0hd050tf5ed5"
          },
          "river_id": {
            "type": "string",
            "example": "5e473b955d7f0h3050tf5ed5"
          },
          "account": {
            "type": "string",
            "example": "5e473b95564f0h3050tf5ed5"
          },
          "run_insert_date": {
            "type": "integer",
            "example": 1584894117231
          },
          "run_update_date": {
            "type": "integer",
            "example": 1584894117231
          },
          "river_run_status": {
            "type": "string",
            "example": "W",
            "enum": [
              "W",
              "D",
              "F",
              "R"
            ],
            "readOnly": true
          },
          "river_run_message": {
            "type": "string",
            "example": "River river_name is waiting to run"
          },
          "_id": {
            "type": "string",
            "example": "5e473b95567f0h3050tf5ed5"
          },
          "tasks_status": {
            "type": "string",
            "example": {
              "task_status": "D",
              "task_status_message": "European Central Bank Currencies API to File Zone Done Successfully"
            },
            "readOnly": true
          },
          "run_end_date": {
            "type": "integer",
            "example": 1584894117231
          }
        }
      },
      "UpdateBySchema": {
        "type": "string",
        "description": "The user Id in Data Integration updated the entity",
        "example": "58b820a0c762711d8c2f60c7",
        "readOnly": true
      },
      "SourceSubRiverSchema": {
        "type": "object",
        "description": "The source parameters wanted to be set in the sub river. For the specifications of the allowed source parameters, please go to Properties section in this API.",
        "example": {
          "date_range": {
            "start_date": "2020-10-10T12:23:34.123Z",
            "end_date": "2020-10-11T12:34:45.123Z",
            "days_back": 5,
            "time_period": "custom"
          },
          "report": "campaigns",
          "connection_id": "5fa7c995f5as82c6crfb9dd565"
        }
      },
      "TargetSubRiverSchema": {
        "type": "object",
        "description": "The target parameters wanted to be set in the sub river. For the specifications of the allowed target parameters, please go to Properties section in this API.",
        "example": {
          "table_name": "ods_klaviyo_campaigns",
          "schema_name": "public"
        }
      },
      "ScheduleSchema": {
        "type": "object",
        "description": "The schedule definition for the sub river, in quartz with 0 seconds required",
        "properties": {
          "cron": {
            "type": "string",
            "example": "* 15 1/2 * * *"
          }
        }
      },
      "ConnectionTypesListSchema": {
        "type": "object",
        "properties": {
          "connection_type": {
            "type": "string",
            "description": "The connection type id"
          },
          "connection_type_name": {
            "type": "string",
            "description": "Connection type display name"
          },
          "is_test_connection": {
            "type": "boolean",
            "description": "Can the connection type be tested or not."
          }
        },
        "example": {
          "connection_type": "fb",
          "connection_type_name": "Facebook Ads",
          "is_test_connection": true
        }
      },
      "ConnectionTypeSchema": {
        "type": "object",
        "properties": {
          "connection_type": {
            "type": "string",
            "description": "The connection type id"
          },
          "connection_type_name": {
            "type": "string",
            "description": "Connection type display name"
          },
          "oauth2": {
            "type": "boolean",
            "description": "Is this a OAuth2 connection type"
          },
          "is_test_connection": {
            "type": "boolean",
            "description": "Can the connection type be tested or not."
          },
          "properties": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The property key to provide in the connection"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "integer",
                    "password",
                    "file",
                    "boolean"
                  ],
                  "description": "The property type to validate. \n If `file`, please provide a valid file path as get and uploaded in the connection files api. \n If `password`, any data provide to this key will be encrypted automatically."
                },
                "input_type": {
                  "type": "string",
                  "enum": [
                    "file"
                  ],
                  "description": "A specific input type required for files"
                }
              }
            }
          }
        },
        "example": [
          {
            "connection_type": "klaviyo",
            "connection_type_name": "Klaviyo",
            "properties": [
              {
                "id": "connection_name",
                "type": "string"
              },
              {
                "id": "connection_description",
                "type": "string"
              },
              {
                "id": "api_key",
                "type": "password"
              }
            ]
          },
          {
            "connection_type": "fb",
            "connection_type_name": "Facebook",
            "oauth2": true,
            "properties": [
              {
                "id": "connection_name",
                "type": "string"
              },
              {
                "id": "client_secrets",
                "type": "password"
              },
              {
                "id": "access_token",
                "type": "password"
              },
              {
                "id": "client_id",
                "type": "string"
              },
              {
                "id": "connection_description",
                "type": "string"
              },
              {
                "id": "credentials",
                "is_credentials": true,
                "type": "password"
              }
            ]
          }
        ]
      },
      "CreateConnectionSchema": {
        "title": "Create Connection Schema",
        "description": "Connection Schema may conatian connection type, connection name, and the wanted properties per the connection type.",
        "required": [
          "connection_type",
          "connection_name"
        ],
        "type": "object",
        "properties": {
          "connection_type": {
            "type": "string"
          },
          "connection_name": {
            "type": "string"
          }
        },
        "example": {
          "connection_type": "aws",
          "connection_name": "My S3 Connection",
          "aws_access_key": "smd0mLSCJHodKndas",
          "aws_access_secrets": "Amndsjkjns0nmnre3.nkdskndYkHDS",
          "connection_method": "aws_keys"
        }
      },
      "ConnectionSchema": {
        "title": "Connection Schema",
        "description": "A connection definition. The connection includes basic parameters repeated for every connection, such as cross_id, _id, connection_name, connection_type, and a dynamic properties as defined in the connection type definition.  In order to get the avilable connection type properties, please refer to connection type API request. Connection definition schema doesn not include any passowrd or credentials secrets returned. Every property typed as `password` of `credentials` will be encrypted automatically on rest, and won't return in the responses. Instead, a `{{propertyId}}_exists` key is returned, indicates there is a data refers the secret key and also is_{{propertyId}}_encrypted key returned, indicates the key was encrypted at rest. In order to update an encrypted key, please purge the entire value connection key (one-way updating).",
        "type": "object",
        "properties": {
          "cross_id": {
            "type": "string",
            "description": "The id shared between accounts and environments",
            "readOnly": true
          },
          "_id": {
            "type": "string",
            "description": "A unique id for this connection",
            "readOnly": true
          },
          "{{propertyId}}_exists": {
            "type": "boolean",
            "description": "An indication that the password key of some connection type key is included in the the connection.",
            "readOnly": true
          },
          "is_{{propertyId}}_encrypted": {
            "type": "boolean",
            "description": "An indication that a password key of some connection type key is encrypted.",
            "readOnly": true
          },
          "connection_name": {
            "type": "string",
            "description": "The connection name"
          },
          "connection_type": {
            "type": "string",
            "description": "The connection type.",
            "example": "aws"
          }
        }
      },
      "RiverDefinitionSchema": {
        "title": "River Definition Schema",
        "description": "A schema for the river's definition.",
        "type": "object",
        "properties": {
          "river_insert_date": {
            "type": "string",
            "description": "The date of the insertion time."
          },
          "river_modified_date": {
            "type": "string",
            "description": "The date of the last modified time."
          },
          "river_time_created": {
            "type": "string",
            "description": "The time the river was created."
          },
          "updated_by_name": {
            "type": "string",
            "description": "The person which lasts modified the river."
          },
          "river_type_title": {
            "type": "string",
            "description": "The river's type."
          },
          "river_name": {
            "type": "string",
            "description": "The river's name."
          },
          "is_master_river": {
            "type": "bool",
            "description": "Whether this is a master river or not."
          },
          "subrivers_enabled": {
            "type": "bool",
            "description": "Are subrivers enabled."
          },
          "source": {
            "type": "object",
            "description": "The source's defintion."
          },
          "target": {
            "type": "object",
            "description": "The target's defintion."
          },
          "is_scheduled": {
            "type": "bool",
            "description": "Whether this river has scheduling policy or not."
          },
          "group_id": {
            "type": "string",
            "description": "The group id of the river."
          }
        }
      },
      "OAuth2Schema": {
        "type": "object",
        "properties": {
          "auth_uri": {
            "type": "string",
            "description": "The auth uri provided from the OAuth2 request. <br> In order to proceed in the OAuth2 process, please take the result, and open it in a web browser tab.\n"
          },
          "pull_id": {
            "type": "string",
            "format": "token",
            "description": "An hashed pull id that attach the auth uri and the correct response from the OAuth2 provider, in order to make sure the OAuth2 provider is the callback sender."
          }
        },
        "example": {
          "pull_id": "Xkoaopdlkmcpoasposam321-9231kd-054kmam,.adslwqirdHA0-NFKDKLAnlka...",
          "auth_uri": "https://www.facebook.com/v6.0/dialog/oauth?..."
        }
      }
    },
    "examples": {
      "ConnectionRequestExamplesS3": {
        "value": {
          "connection_type": "aws",
          "connection_name": "My S3 Connection",
          "aws_access_key": "smd0mLSCJHodKndas",
          "aws_access_secrets": "Amndsjkjns0nmnre3.nkdskndYkHDS",
          "connection_method": "aws_keys"
        }
      },
      "ConnectionRequestExamplesOAuth": {
        "value": {
          "connection_type": "fb",
          "connection_name": "Facebook Connection (OAuth2 Connection)",
          "credentials": {
            "access_token": "Amndsjkjns0nmnre3.nkdskndYkHDS",
            "expired": 3600,
            "message": "Connected to Facebook",
            "client_id": "123456789kd"
          }
        }
      },
      "ConnectionRequestExamplesFile": {
        "value": {
          "connection_type": "mssql",
          "connection_name": "My SQL Server Database",
          "username": "user",
          "password": "passowrd1",
          "host": "134.235.56.32",
          "port": 1432,
          "database": "my_db",
          "ssh_pkey_filename": "{key_file_path}/<account>/<connection_type>/<uuid>_filename.pem",
          "ssh_host_name": "127.0.0.1",
          "ssh_port": 22,
          "ssh_username": "rivery"
        }
      }
    },
    "securitySchemes": {
      "BearerToken": {
        "type": "http",
        "scheme": "Bearer",
        "description": "### Data Integration API Token\n\nTo generate a Bearer token, please check out our docs in [here](https://help.boomi.com/docs/Atomsphere/Data_Integration/RESTAPI/dataintegration-api-overview).\n\nEvery bearer token is a combination of account, environment, and scopes attached. Every time the token is provided, the API compares its scopes with the request's required scope. If the scope is not valid, an *insufficient permissions (403)* response code is returned.\n\n---\n\n### Scopes\n\nA scope is defined as a combination of the **entity** in Data Integration and the **operation** allowed to be performed on that entity.\n\n- **Entity**: Can be any object exposed via the API (e.g., `connection`).\n- **Operation**: One of the allowed actions such as `list`, `edit`, etc.\n\nFor example:\n- `connection:list` → permission to list connections\n- `connection:edit` → permission to edit a connection\n\nEnsure that the Bearer token contains the correct scopes for the requests being made.\n\n---\n\n### Request Header Example\n```bash\ncurl -X GET -H \"Authorization: Bearer <token>\" /api/connection_types\n```\n\n---\n\n### More Info\nFor more information about creating and managing tokens in Data Integration, refer to the token management documentation."
      }
    },

    "parameters": {
      "riverIdParam": {
        "name": "riverId",
        "in": "path",
        "description": "The river ID to reference for",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "5faa7bd17bedeb66f4c287c7"
      },
      "subRiverId": {
        "name": "subRiverId",
        "in": "path",
        "description": "The river ID to reference for",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "5faa7bd17bedeb66f4c287c7"
      },
      "connectionTypeId": {
        "name": "connectionTypeId",
        "in": "path",
        "description": "Connection type id.",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": [
          "fb_ads",
          "aws",
          "klaviyo"
        ]
      },
      "connectionId": {
        "name": "connectionId",
        "in": "path",
        "description": "connection id",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "5faa7bd17bedeb66f4c287c7"
      },
      "connectionKeyPairId": {
        "name": "id",
        "in": "query",
        "description": "connection key pair id",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "5faa7bd17bedeb66f4c287c7"
      },
      "pullRequestId": {
        "name": "pull_request_id",
        "in": "query",
        "description": "pull request id",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "5faa7bd17bedeb66f4c287c7"
      },
      "resultsId": {
        "name": "results_id",
        "in": "query",
        "description": "results id",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "5faa7bd17bedeb66f4c287c7"
      }      
    },
    "requestBodies": {
      "subRiversRequest": {
        "description": "An Array of sub rivers to create or update.",
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "sub_rivers": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SubRiverSchema"
                  }
                }
              }
            }
          }
        }
      },
      "createNewConnectionRequest": {
        "description": "Create New Connection using the connection name, connection type, and connection paramters as described in connection parameters API request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CreateConnectionSchema"
            },
            "examples": {
              "Key Val": {
                "$ref": "#/components/examples/ConnectionRequestExamplesS3"
              },
              "OAuth2": {
                "$ref": "#/components/examples/ConnectionRequestExamplesOAuth"
              },
              "Pem File": {
                "$ref": "#/components/examples/ConnectionRequestExamplesFile"
              }
            }
          }
        }
      },
      "OAuth2Request": {
        "description": "Ask for new OAuth2 process from Data Integration. The request includes a datasource_type in the body.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "datasource_id": {
                  "description": "A valid datasource id in Data Integration.",
                  "type": "string",
                  "example": "fb",
                  "required": true
                },
                "validity_duration": {
                  "type": "integer",
                  "maximum": 43200,
                  "minimum": 300,
                  "description": "The maximum time in seconds, the auth_uri and pull_id are valid. *maximum* = 12 hours (43200 seconds). An invalid time will return 429 (invalid param) status code.\n",
                  "required": false
                }
              }
            }
          }
        }
      },
      "OAuth2GetCredentials": {
        "description": "Getting the credentials from the OAuth2 request",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "schema": {
                  "$ref": "#/components/schemas/OAuth2Schema"
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "InsufficientPermissionResponse": {
        "description": "The token is not authorized to the requested scope/method",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              },
              "example": {
                "message": "insufficient Permissions"
              }
            }
          }
        }
      },
      "InvalidParamResponse": {
        "description": "An invalid parameter had been provided to the request. Please check your parameters.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              },
              "example": {
                "message": "invalid parameter: validity_duration must be a number"
              }
            }
          }
        }
      },
      "NotFoundObjectResponse": {
        "description": "The object (river/connection...) provided could not be found",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                }
              },
              "example": {
                "message": "River doesn't exist or is temporarily unavailable, please enter a valid river id and try again.\n",
                "status": "Error"
              }
            }
          }
        }
      },
      "ExpiredParamResponse": {
        "description": "An invalid pull_id and auth_uri combination, or the maximum validation duration of the auth_uri passed\n",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              },
              "example": {
                "message": "Invalid request or request expired"
              }
            }
          }
        }
      },
      "SubRiversColumnsResponse": {
        "description": "The sub river valid columns that can be provided to the subrivers in this river.\n",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "cross_id": {
                  "$ref": "#/components/schemas/CrossIdSchema"
                },
                "river_id": {
                  "$ref": "#/components/schemas/RiverIdSchema"
                },
                "account": {
                  "$ref": "#/components/schemas/AccountSchema"
                },
                "env_id": {
                  "$ref": "#/components/schemas/EnvIdSchema"
                },
                "cloumns": {
                  "$ref": "#/components/schemas/SubRiverColumnSchema"
                }
              }
            }
          }
        }
      },
      "ListRiversResponse": {
        "description": "List of rivers.\n",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "cross_id": {
                  "$ref": "#/components/schemas/CrossIdSchema"
                },
                "river_id": {
                  "$ref": "#/components/schemas/RiverIdSchema"
                },
                "river_definitions": {
                  "$ref": "#/components/schemas/RiverDefinitionSchema"
                }
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/api/datasource_types": {
      "get": {
        "tags": [
          "Datasource Types"
        ],
        "summary": "Get Datasource List",
        "description": "Get the list of data source types connectors in the platform.\n* **scope:** `datasource:list`\n",
        "operationId": "DatasourceTypeList",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Datasource types list. List of datasource types in the platform.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DatasourceTypeSchema"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location --request GET 'https://console.rivery.io/api/datasource_types' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/datasource_types/{{segment}}\"\n\npayload={}\nheaders = {\n'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/datasource_types/{{segment}}": {
      "get": {
        "tags": [
          "Datasource Types"
        ],
        "summary": "Get the datasource list by segment",
        "description": "Get the datasource types list by segments (connection/target/source). Use this request in order to get the available sources, targets or connections in Data Integration.\n* **scope:** `datasource:list`\n",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Datasource types list by segment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DatasourceTypeSchema"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/connection_types": {
      "get": {
        "tags": [
          "Connection Types and Properties"
        ],
        "summary": "Connection Types List",
        "description": "Get the available connection types that can be provided in Data Integration.\n* **scope:** `connection:list`\n",
        "operationId": "ConnectionTypesList",
        "parameters": [],
        "responses": {
          "200": {
            "description": "The available connection types can be used in Data Integration",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ConnectionTypesListSchema"
                  }
                }
              }
            },
            "links": {
              "GetConnectionPropertiesByType": {
                "operationId": "ConnectionTypeProperties",
                "parameters": {
                  "connectionTypeId": "$response.body#/connection_type"
                },
                "description": "Use the connection type id in order to get the valid properties that every connection can get.\n"
              },
              "UplodaFileByConnectionType": {
                "operationId": "CreateConnectionKeyFile",
                "parameters": {
                  "connectionTypeId": "$response.body#/connection_type"
                },
                "description": "Use the connection type id in order to determine the connection type that the file is referred to\n"
              },
              "ConnectionsCreate": {
                "operationId": "CreateConnection",
                "requestBody": "$response.body#/connection_type",
                "description": "Connection type is required in creating connection\n"
              },
              "ConnectionsUpdate": {
                "operationId": "UpdateConnection",
                "requestBody": "$response.body#/connection_type",
                "description": "Connection type is required in updating connection\n"
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        }
      }
    },
    "/api/connections/properties/{{connectionTypeId}}": {
      "get": {
        "tags": [
          "Connection Types and Properties"
        ],
        "summary": "Connection Type Properties",
        "description": "* **scope:** `connection:list`\n",
        "operationId": "ConnectionTypeProperties",
        "parameters": [
          {
            "$ref": "#/components/parameters/connectionTypeId"
          }
        ],
        "responses": {
          "200": {
            "description": "Connection Type properties allowed per connection type id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionTypeSchema"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        }
      }
    },
    "/api/connections/key_pair": {
      "get": {
        "tags": [
          "Connection Key Files"
        ],
        "summary": "Get Connection Key details",
        "description": "Returns the connection key pair details\n * **scope:** `connection:list`\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/connectionKeyPairId"
          }
        ],
        "responses": {
          "200": {
            "description": "The connection key pair details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key_pair_id": {
                      "type": "string",
                      "example": "5fa7c995f5as82c6crfb9dd565"
                    },
                    "key_file_name": {
                      "type": "string",
                      "example": "{key_file_path}/5f3934444c40e5336f77c34b/5f3934444c40e5336f77c34d/uficudkfcx2_mypem.pem"
                    },
                    "key_name": {
                      "type": "string",
                      "example": "uficudkfcx2_mypem.pem"
                    },
                    "public_key": {
                      "type": "string",
                      "example": "MFkwEwYHKoZIzj0CAQYI....."
                    },
                    "is_key_file": {
                      "type": "boolean"
                    },
                    "connection_type": {
                      "type": "string",
                      "example": "redshift"
                    },
                    "env_id": {
                      "$ref": "#/components/schemas/EnvIdSchema"
                    },
                    "account": {
                      "$ref": "#/components/schemas/AccountSchema"
                    },
                    "user_created": {
                      "$ref": "#/components/schemas/UpdateBySchema"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Can't get public key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "example": "Can not get the public key from this key pair"
                    },
                    "status": {
                      "type": "integer",
                      "example": 400
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Connection Key Files"
        ],
        "summary": "Delete Connection Key Pair",
        "description": "Deletes the connection key pair\n * **scope:** `connection:edit`\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/connectionKeyPairId"
          }
        ],
        "responses": {
          "200": {
            "description": "The connection key pair was deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Key Pair 5fa7c995f5as82c6crfb9dd565 deleted"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No key pair found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "example": "Key pair id does not exist"
                    },
                    "status": {
                      "type": "integer",
                      "example": 404
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Error when deleting key pair.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "example": "Problem while deleting key pair. Please check with administrator"
                    },
                    "status": {
                      "type": "integer",
                      "example": 500
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/connections/{{connectionTypeId}}/file": {
      "post": {
        "tags": [
          "Connection Key Files"
        ],
        "summary": "Create Connection Key file",
        "description": "Upload and creating new key file in the system. Key file is required for some connections keys, when the connection type property `type` value in `file`.\n * **scope:** `connection:edit`\n",
        "operationId": "CreateConnectionKeyFile",
        "parameters": [
          {
            "$ref": "#/components/parameters/connectionTypeId"
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "file"
                ],
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A file uploaded successfully. Use the `key_file_name` and attach it to the right key in the connection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key_file_name": {
                      "type": "string",
                      "example": "{key_file_path}/5f3934444c40e5336f77c34b/5f3934444c40e5336f77c34d/uficudkfcx2_mypem.pem"
                    },
                    "is_key_file": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "An invalid file, or a not-allowed file provided",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "example": "File Not Allowed"
                    },
                    "status": {
                      "type": "integer",
                      "example": 402
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          },
          "404": {
            "description": "No file provided to the request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "example": "File not provided"
                    },
                    "status": {
                      "type": "integer",
                      "example": 404
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Error when the upload failed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reason": {
                      "type": "string",
                      "example": "uploading key file failed. reason: ..."
                    },
                    "status": {
                      "type": "integer",
                      "example": 500
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/connections/list": {
      "get": {
        "tags": [
          "Connection Management"
        ],
        "summary": "List All Connections",
        "description": "* **scope:** `connection:list`\n",
        "responses": {
          "200": {
            "description": "The connection details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ConnectionSchema"
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl\n--location\n--request GET  'https://console.rivery.io/api/connections/list' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/connections/list\"\n\npayload={}\nheaders = {\n'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/connections/{{connectionTypeId}}": {
      "get": {
        "tags": [
          "Connection Management"
        ],
        "summary": "Filter Connections By Connection Type",
        "description": "* **scope:** `connection:list`\n",
        "parameters": [
          {
            "name": "connection_type",
            "in": "query",
            "description": "Filter connections by connection types",
            "required": true,
            "style": "form",
            "explode": true,
            "schema": {
              "type": "string",
              "example": "fb"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The connection details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionSchema"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl\n--location -g\n--request GET  'https://console.rivery.io/api/connections/{{connectionTypeId}}?cross_id=' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/connections/{{connectionTypeId}}?cross_id=\"\n\npayload={}\nheaders = {\n'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/connections": {
      "put": {
        "tags": [
          "Connection Management"
        ],
        "operationId": "CreateConnection",
        "summary": "Create New Connection",
        "description": "* **scope:** `connection:edit`\n",
        "requestBody": {
          "$ref": "#/components/requestBodies/createNewConnectionRequest"
        },
        "responses": {
          "200": {
            "description": "The connection details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionSchema"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl\n--location\n--request PUT 'https://console.rivery.io/api/connections' \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n\"connection_type\": \"aws\",\n\"connection_name\": \"My S3 Connection\",\n\"aws_access_key\": \"smd0mLSCJHodKndas\",\n\"aws_access_secrets\": \"Amndsjkjns0nmnre3.nkdskndYkHDS\",\n\"connection_method\": \"aws_keys\"\n}'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\nimport json\n\nurl = \"https://console.rivery.io/api/connections\"\n\npayload = json.dumps({\n\"connection_type\": \"aws\",\n\"connection_name\": \"My S3 Connection\",\n\"aws_access_key\": \"smd0mLSCJHodKndas\",\n\"aws_access_secrets\": \"Amndsjkjns0nmnre3.nkdskndYkHDS\",\n\"connection_method\": \"aws_keys\"\n})\nheaders = {\n'Authorization': 'Bearer <token>',\n'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"PUT\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/connections/{{connectionId}}": {
      "get": {
        "tags": [
          "Connection Management"
        ],
        "summary": "Get Specific Connection",
        "description": "* **scope:** `connection:list`\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/connectionId"
          }
        ],
        "responses": {
          "200": {
            "description": "The connection details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionSchema"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl\n--location -g\n--request GET  'https://console.rivery.io/api/connections/{{connectionId}}' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/connections/{{connectionId}}\"\n\npayload={}\nheaders = {\n'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      },
      "patch": {
        "tags": [
          "Connection Management"
        ],
        "summary": "Update Connection by ID",
        "operationId": "UpdateConnection",
        "description": "* **scope:** `connection:edit`\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/connectionId"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/createNewConnectionRequest"
        },
        "responses": {
          "200": {
            "description": "An updated message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "boolean"
                    },
                    "code": {
                      "type": "integer"
                    },
                    "count": {
                      "type": "integer",
                      "example": 1
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          },
          "404": {
            "description": "The connection id is not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Cross Id Not Found"
                    }
                  }
                }
              }
            }
          },
          "x-codeSamples": [
            {
              "lang": "cURL",
              "label": "cURL",
              "source": "curl --location -g --request PATCH 'https://console.rivery.io/api/connections/{{connectionId}}' \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n\"connection_type\": \"aws\",\n\"connection_name\": \"My S3 Connection\",\n\"aws_access_key\": \"smd0mLSCJHodKndas\",\n\"aws_access_secrets\": \"Amndsjkjns0nmnre3.nkdskndYkHDS\",\n\"connection_method\": \"aws_keys\"\n}'\n"
            },
            {
              "lang": "python",
              "label": "Python",
              "source": "import requests\nimport json\n\nurl = \"https://console.rivery.io/api/connections/{{connectionId}}\"\n\npayload = json.dumps({\n\"connection_type\": \"aws\",\n\"connection_name\": \"My S3 Connection\",\n\"aws_access_key\": \"smd0mLSCJHodKndas\",\n\"aws_access_secrets\": \"Amndsjkjns0nmnre3.nkdskndYkHDS\",\n\"connection_method\": \"aws_keys\"\n})\nheaders = {\n'Authorization': 'Bearer <token>',\n'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
            }
          ]
        }
      },
      "delete": {
        "tags": [
          "Connection Management"
        ],
        "summary": "Delete Connection By ID",
        "description": "* **scope:** `connection:delete`\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/connectionId"
          }
        ],
        "responses": {
          "200": {
            "description": "An updated message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "boolean"
                    },
                    "code": {
                      "type": "integer"
                    },
                    "deleted_count": {
                      "type": "integer",
                      "example": 1
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          },
          "404": {
            "description": "The connection id is not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Cross Id Not Found"
                    }
                  }
                }
              }
            }
          },
          "420": {
            "description": "In case there are some rivers that requires the connection to be exist (for example, in the CDC rivers) the connection can not be deleted. Please manually disable/delete the connected rivers and delete the connection again",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "There are some rivers that their log couldn't be disabled.  Please manually disable the log in the rivers and delete the connection again "
                    },
                    "rivers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "river ids",
                        "example": [
                          "5f3934444c40e5336f77c34b",
                          "5f3934444c40e5336f77c594"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl\n--location -g\n--request DELETE  'https://console.rivery.io/api/connections/{{connectionId}}' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/connections/{{connectionId}}\"\n\npayload={}\nheaders = {\n'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"DELETE\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/oauth2": {
      "post": {
        "tags": [
          "OAuth2 Connections"
        ],
        "summary": "OAuth2 New Credentials Requst",
        "operationId": "OAuth2NewCredentialsRequst",
        "description": "Initiating new OAuth2 process using Data Integration. <br> The request will provide an external link of `auth_uri`, that can be hit externally to the API (using any web browser). After the process will end in the provider side, Data Integration will get a callback request from the OAuth2 provider, and Data Integration will continue the process. <br> In order to get the OAuth2 process response, please continue to `/oauth2/credentials`.\n* **scope:** `connection:edit`\n",
        "requestBody": {
          "$ref": "#/components/requestBodies/OAuth2Request"
        },
        "responses": {
          "200": {
            "description": "Response will include `auth_uri` and `pull_id` to provide to `/oauth2/credentials` request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuth2Schema"
                }
              }
            },
            "links": {
              "OAuth2GetCredentials": {
                "requestBody": "$response.body"
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/ExpiredParamResponse"
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          },
          "429": {
            "$ref": "#/components/responses/InvalidParamResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location --request POST 'https://console.rivery.io/api/oauth2' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer <token>' \\\n--data-raw '{\n\"datasource_id\": \"fb\",\n\"validity_duration\": 300\n}'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\nimport json\n\nurl = \"https://console.rivery.io/api/oauth2\"\n\npayload = json.dumps({\n\"datasource_id\": \"fb\",\n\"validity_duration\": 300\n})\nheaders = {\n'Content-Type': 'application/json',\n'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/oauth2/credentials": {
      "post": {
        "tags": [
          "OAuth2 Connections"
        ],
        "summary": "OAuth2 Get Credentials",
        "operationId": "OAuth2GetCredentials",
        "description": "Getting the results of the Oauth2 process request.\n* **scope:** `connection:edit`\n",
        "parameters": [],
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OAuth2Schema"
              },
              "example": {
                "pull_id": "eyJhbGciOiJIUzI1NiIsImV4cCI6MTUwMjM3OTk3NywiaWF0IjoxNTAyMzc5Mz....",
                "auth_uri": "https://login.windows.net/..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "After the OAuth2 process ends, This is the credentials got from the OAuth2 provider. <br> The response may saved as `credentials` key in the connections that support this key.`\n",
            "content": {
              "application/json": {
                "example": {
                  "access_token": "Sksosa43ma904mnfnmaklasioewjns.akjsadiuewq",
                  "message": "Facebook Ads Connected Successfully",
                  "userId": 12847564034,
                  "status": 200,
                  "clientId": 194785639383273120
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/ExpiredParamResponse"
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location --request POST 'https://console.rivery.io/api/oauth2/credentials' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer <token>' \\\n--data-raw '{\n\"pull_id\": \"eyJhbGciOiJIUzI1NiIsImV4cCI6MTUwMjM3OTk3NywiaWF0IjoxNTAyMzc5Mz....\",\n\"auth_uri\": \"https://login.windows.net/...\"\n}'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\nimport json\n\nurl = \"https://console.rivery.io/api/oauth2/credentials\"\n\npayload = json.dumps({\n\"pull_id\": \"eyJhbGciOiJIUzI1NiIsImV4cCI6MTUwMjM3OTk3NywiaWF0IjoxNTAyMzc5Mz....\",\n\"auth_uri\": \"https://login.windows.net/...\"\n})\nheaders = {\n'Content-Type': 'application/json',\n'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/connections/share_creation_link/{{datasourceTypeId}}": {
      "get": {
        "tags": [
          "Share Connection"
        ],
        "summary": "Get Connection Creation Shareable Link",
        "opeartionId": "ConnectionShareLink",
        "description": "Data Integration provides the ability to get a shareable link, that will open a connection modal (html) which can be shared with 3rd parties (like customers) in order to create a new connection inside Data Integration. The link is one-time only, and expires after 24 hours at most.\n* **scope:** `connection:share`\n",
        "parameters": [],
        "responses": {
          "200": {
            "description": "An object with an url that be shared.\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "link",
                      "example": "https://rivery.io/...."
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request GET 'https://console.rivery.io/api/connections/share_creation_link/{{datasourceTypeId}}' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/connections/share_creation_link/{{datasourceTypeId}}\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)f\n"
          }
        ]
      }
    },
    "/api/run": {
      "post": {
        "tags": [
          "Run River"
        ],
        "summary": "Execute an existing river or sub river.",
        "description": "Use the river_id to execute an existing river or a sub river cross_id.\n\nYou can find the river id in the url of the river in the console:\n\n`https://console.rivery.io/river/{}/{}/river/{river_id}`.\n\nFor logic rivers: \n\n`https://console.rivery.io/rivers/{}/{}/{river_id}`.\n\nThe sub river's cross_id can be found by using the GET sub rivers call, or by the id of every sub river in the console.\n\nscope: `river:execute`",
        "operationId": "executeRiver",
        "requestBody": {
          "description": "River id or sub river id to be executed",
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/River"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunRiverSchema"
                }
              }
            }
          },
          "401": {
            "description": "Missing asset",
            "content": {}
          },
          "403": {
            "description": "Blocked account",
            "content": {}
          },
          "429": {
            "$ref": "#/components/responses/InvalidParamResponse"
          }
        },
        "x-codegen-request-body-name": "body",
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl\n--location --request POST 'https://console.rivery.io/api/run' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer <token>' \\\n--data-raw '{\n\"river_id\": \"5e5fbbc2567409482d8511cd\"\n}'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\nimport json\n\nurl = \"https://console.rivery.io/api/run\"\n\npayload = json.dumps({\n \"river_id\": \"5e5fbbc2567409482d8511cd\"\n})\nheaders = {\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/check_run": {
      "get": {
        "tags": [
          "Run River"
        ],
        "summary": "Check the execution status of a river",
        "description": "Use the `run_id` returned for the run endpoint to check the status of a river execution. \n There are 4 available statuses for a river: \n - `W` = Waiting\n - `R` = Running \n - `E` = Error (failed), includes also the error message under error_description key.\n - `D` = Done Successfully.\n\nOnce the `river_run_status` key is set to 'D' the river has finished successfully\n\n - scope: `river:execute`",
        "operationId": "checkRiver",
        "parameters": [
          {
            "name": "run_id",
            "in": "query",
            "description": "Run id to check",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunRiverSchema"
                }
              }
            }
          },
          "401": {
            "description": "Missing asset",
            "content": {}
          },
          "403": {
            "description": "Blocked account",
            "content": {}
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location\n--request GET 'https://console.rivery.io/api/check_run' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/check_run\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/rivers": {
      "get": {
        "summary": "Get Rivers List",
        "description": "List all rivers under the acoount-environment the token refers to\n* **scope:** `river:list`\n",
        "parameters": [
          {
            "name": "group",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "An optional parameter that will filter rivers by group name"
          }
        ],
        "responses": {
          "200": {
            "description": "The list of rivers and their properties",
            "$ref": "#/components/responses/ListRiversResponse"
          }
        },
        "tags": [
          "Get River"
        ],
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location\n--request GET 'https://console.rivery.io/api/rivers' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/rivers\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/rivers/<river_id>": {
      "get": {
        "summary": "Get River",
        "description": "Get a River by the River ID\n* **scope:** `river:list`\n",
        "responses": {
          "200": {
            "description": "Rivers properties",
            "$ref": "#/components/responses/ListRiversResponse"
          }
        },
        "tags": [
          "Get River"
        ],
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location\n--request GET 'https://console.rivery.io/api/rivers/<river_id>' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/rivers/<river_id>\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/rivers/properties/subrivers": {
      "get": {
        "description": "Get Sub Rivers Properties by Datasource ID",
        "parameters": [
          {
            "name": "datasource_id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "example": "klaviyo"
          }
        ],
        "responses": {
          "200": {
            "description": "The list of sub rivers properties allowed to use",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiverAllowedProperties"
                }
              }
            }
          }
        },
        "tags": [
          "Sub Rivers Properties"
        ],
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location\n--request GET 'https://console.rivery.io/api/rivers/properties/subrivers?datasource_id=' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/rivers/properties/subrivers?datasource_id=\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/rivers/{riverId}/properties": {
      "get": {
        "tags": [
          "Sub Rivers Properties"
        ],
        "description": "Get Sub Rivers Properties by River ID",
        "parameters": [
          {
            "$ref": "#/components/parameters/riverIdParam"
          }
        ],
        "responses": {
          "200": {
            "description": "Return properties by river id - the method check the source and the target of the river and return the correct properties for each section.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "river_id": {
                      "type": "string",
                      "description": "the river id"
                    },
                    "river_name": {
                      "type": "string",
                      "description": "the river name"
                    },
                    "river_type": {
                      "type": "string",
                      "description": "The river type (src_to_trgt, logic, action)"
                    },
                    "source": {
                      "$ref": "#/components/schemas/RiverAllowedProperties"
                    },
                    "target": {
                      "$ref": "#/components/schemas/RiverAllowedProperties"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request GET 'https://console.rivery.io/api/rivers/{{riverId}}/properties' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/rivers/{{riverId}}/properties\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/rivers/{riverId}/sub_rivers": {
      "get": {
        "tags": [
          "Sub Rivers Management"
        ],
        "summary": "Get sub river per river",
        "parameters": [
          {
            "$ref": "#/components/parameters/riverIdParam"
          }
        ],
        "responses": {
          "200": {
            "description": "The sub river object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubRiverSchema"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request GET 'https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      },
      "put": {
        "tags": [
          "Sub Rivers Management"
        ],
        "summary": "Create new sub river for river",
        "parameters": [
          {
            "$ref": "#/components/parameters/riverIdParam"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/subRiversRequest"
        },
        "responses": {
          "200": {
            "description": "The sub river object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubRiverSchema"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request PUT 'https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers' \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"sub_rivers\": [\n        {\n            \"name\": \"My Subriver\",\n            \"description\": \"My Facebook clients sub river\",\n            \"source\": {\n                \"date_range\": {\n                    \"start_date\": \"2020-10-10T12:23:34.123Z\",\n                    \"end_date\": \"2020-10-11T12:34:45.123Z\",\n                    \"days_back\": 5,\n                    \"time_period\": \"custom\"\n                },\n                \"report\": \"campaigns\",\n                \"connection_id\": \"5fa7c995f5as82c6crfb9dd565\"\n            },\n            \"target\": {\n                \"table_name\": \"ods_klaviyo_campaigns\",\n                \"schema_name\": \"public\"\n            },\n            \"is_scheduled\": true,\n            \"schedule\": {\n                \"cron\": \"* 15 1/2 * * *\"\n            },\n            \"inherit_schedule\": true,\n            \"is_enabled\": false\n        }\n    ]\n}'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\nimport json\n\nurl = \"https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers\"\n\npayload = json.dumps({\n \"sub_rivers\": [\n   {\n     \"name\": \"My Subriver\",\n     \"description\": \"My Facebook clients sub river\",\n     \"source\": {\n       \"date_range\": {\n         \"start_date\": \"2020-10-10T12:23:34.123Z\",\n         \"end_date\": \"2020-10-11T12:34:45.123Z\",\n         \"days_back\": 5,\n         \"time_period\": \"custom\"\n       },\n       \"report\": \"campaigns\",\n       \"connection_id\": \"5fa7c995f5as82c6crfb9dd565\"\n     },\n     \"target\": {\n       \"table_name\": \"ods_klaviyo_campaigns\",\n       \"schema_name\": \"public\"\n     },\n     \"is_scheduled\": True,\n     \"schedule\": {\n       \"cron\": \"* 15 1/2 * * *\"\n     },\n     \"inherit_schedule\": True,\n     \"is_enabled\": False\n   }\n ]\n})\nheaders = {\n 'Authorization': 'Bearer <token>',\n 'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"PUT\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/rivers/{riverId}/sub_rivers/{subRiverId}": {
      "get": {
        "tags": [
          "Sub Rivers Management"
        ],
        "summary": "Get data from specific sub river id",
        "parameters": [
          {
            "$ref": "#/components/parameters/riverIdParam"
          },
          {
            "$ref": "#/components/parameters/subRiverId"
          }
        ],
        "responses": {
          "200": {
            "description": "The sub river parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubRiverSchema"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFoundObjectResponse"
          },
          "429": {
            "$ref": "#/components/responses/InvalidParamResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request GET 'https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/{{subRiverId}}' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/{{subRiverId}}\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      },
      "patch": {
        "tags": [
          "Sub Rivers Management"
        ],
        "summary": "Update specific sub river by sub river id and river id",
        "parameters": [
          {
            "$ref": "#/components/parameters/riverIdParam"
          },
          {
            "$ref": "#/components/parameters/subRiverId"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/subRiversRequest"
        },
        "responses": {
          "200": {
            "description": "Update success message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "1 subriver had been updated"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request PATCH 'https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/{{subRiverId}}' \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"sub_rivers\": [\n        {\n            \"name\": \"My Subriver\",\n            \"description\": \"My Facebook clients sub river\",\n            \"source\": {\n                \"date_range\": {},\n                \"report\": \"campaigns\",\n                \"connection_id\": \"5fa7c995f5as82c6crfb9dd565\"\n            },\n            \"target\": {\n                \"table_name\": \"ods_klaviyo_campaigns\",\n                \"schema_name\": \"public\"\n            },\n            \"is_scheduled\": true,\n            \"schedule\": {\n                \"cron\": \"* 15 1/2 * * *\"\n            },\n            \"inherit_schedule\": true,\n            \"is_enabled\": false\n        }\n    ]\n}'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\nimport json\n\nurl = \"https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/{{subRiverId}}\"\n\npayload = json.dumps({\n \"sub_rivers\": [\n   {\n     \"name\": \"My Subriver\",\n     \"description\": \"My Facebook clients sub river\",\n     \"source\": {\n       \"date_range\": {},\n       \"report\": \"campaigns\",\n       \"connection_id\": \"5fa7c995f5as82c6crfb9dd565\"\n     },\n     \"target\": {\n       \"table_name\": \"ods_klaviyo_campaigns\",\n       \"schema_name\": \"public\"\n     },\n     \"is_scheduled\": True,\n     \"schedule\": {\n       \"cron\": \"* 15 1/2 * * *\"\n     },\n     \"inherit_schedule\": True,\n     \"is_enabled\": False\n   }\n ]\n})\nheaders = {\n 'Authorization': 'Bearer <token>',\n 'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      },
      "delete": {
        "summary": "Delete sub river by id",
        "tags": [
          "Sub Rivers Management"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/riverIdParam"
          },
          {
            "$ref": "#/components/parameters/subRiverId"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "sub river deleted"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          },
          "500": {
            "description": "Delete failed - internal error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "messag": {
                      "type": "string",
                      "example": "Error on deleting subriver: {subRiverId}."
                    },
                    "status": {
                      "type": "string",
                      "example": "Error"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request DELETE 'https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/{{subRiverId}}' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/{{subRiverId}}\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"DELETE\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/rivers/{riverId}/sub_rivers/columns": {
      "get": {
        "tags": [
          "Sub Rivers Columns"
        ],
        "summary": "Get sub rivers columns headers by River.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/riverIdParam"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SubRiversColumnsResponse"
          },
          "404": {
            "$ref": "#/components/responses/NotFoundObjectResponse"
          },
          "429": {
            "$ref": "#/components/responses/InvalidParamResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request GET 'https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/columns' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/columns\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      },
      "patch": {
        "tags": [
          "Sub Rivers Columns"
        ],
        "summary": "Change the Sub River column headers in River.",
        "description": "Create/Delete/Update order of sub river columns in specific riverId.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/riverIdParam"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubRiverColumnSchema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/SubRiversColumnsResponse"
          },
          "404": {
            "$ref": "#/components/responses/NotFoundObjectResponse"
          },
          "429": {
            "$ref": "#/components/responses/InvalidParamResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location -g\n--request PATCH 'https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/columns' \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n\"key\": \"target_table\",\n\"scope\": \"source\"\n}'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\nimport json\n\nurl = \"https://console.rivery.io/api/rivers/{{riverId}}/sub_rivers/columns\"\n\npayload = json.dumps({\n \"key\": \"target_table\",\n \"scope\": \"source\"\n})\nheaders = {\n 'Authorization': 'Bearer <token>',\n 'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/activities/runs/logs": {
      "get": {
        "tags": [
          "Activity Logs"
        ],
        "summary": "Download an existing run's logs of a River",
        "description": "Use run's `id` to fetch the logs of this specific run. \n\n You can find the run id in the console, under the `Activites tab`. \n\n >**Note** Please note that this call is an async call and will return a queryid param in the response To fetch the logs, please send the same request again with the provided queryid parameter \n- scope: `activity:log`",
        "operationId": "downloadActivityLogs",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "Run id to check",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "queryId",
            "in": "query",
            "description": "The the query id from the response",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                },
                "examples": {
                  "csv table": {
                    "summary": "Logs table",
                    "value": "logTimestamp, level, msg \\n 2021-05-27 09:50:39.015 , INFO , Get activity of run_id: [run_id]"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Logs are not available for this river type",
            "content": {}
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl --location\n--request GET 'https://console.rivery.io/api/activities/runs/logs?run_id' \\\n--header 'Authorization: Bearer <token>'\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import requests\n\nurl = \"https://console.rivery.io/api/activities/runs/logs?run_id\"\n\npayload={}\nheaders = {\n 'Authorization': 'Bearer <token>'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
          }
        ]
      }
    },
    "/api/pull/results": {
      "put": {
        "tags": [
          "Create pull requests for results"
        ],
        "summary": "Create pull request to trigger an ASYNC results preview action",
        "operationId": "createResultsPullRequest",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubRiverSchema"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PullRequestResponseSchema"
                    }
                  }
                },
                "examples": {
                  "PullRequestResponse": {
                    "summary": "Pull Request Response",
                    "value": "{\"request_status\": \"W\", \"_id\": {\"$oid\": \"61df516b19694a40aa8e24cc\"}, \"results\": []}"
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        }
      },
      "get": {
        "tags": [
          "Get result id"
        ],
        "summary": "Get the results id from the pull request response",
        "operationId": "getPullRequestResultsId",
        "parameters": [
          {
            "$ref": "#/components/parameters/pullRequestId"
          }
        ],
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PullRequestResponseSchema"
                    }
                  }
                },
                "examples": {
                  "PullRequestResponse": {
                    "summary": "Pull Request Response",
                    "value": "{\"request_status\": \"D\", \"_id\": {\"$oid\": \"61df516b19694a40aa8e24cc\"}, \"results\": {results_id: \"61df516b19694a40aa8e2422\"}}"
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        }
      }
    },
    "/api/results": {
      "get": {
        "tags": [
          "Get results"
        ],
        "summary": "Get the results based on results ID",
        "operationId": "getPreviewResults",
        "parameters": [
          {
            "$ref": "#/components/parameters/resultsId"
          }
        ],
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "type": "json",
                    "items": {
                      "$ref": "#/components/schemas/resultsSchema"
                    }
                  }
                },
                "examples": {
                  "PullRequestResponse": {
                    "summary": "Results",
                    "value": "{\"compiled_query\": \"SELECT * FROM TABLE\", \"results\": \"{\"col_a\": 901, \"col_b\": \"John\"}\"}"
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/InsufficientPermissionResponse"
          }
        }
      }
    }
  }
}