---
updatedAt: 2026-07-22T12:57:38.000Z
agentTools:
  projectIndex: https://developer.doit.com/llms.txt
---

# Create a connection

Creates a new cloud provider connection. Exactly one of `gcpConfig` or `awsConfig` must be supplied.
Returns `400 invalid_connection_config` when both or neither are present.

When `collaborators` lists no owner, the caller is added as the owner (or promoted to owner when
already listed), so a connection created without `collaborators` stays manageable by its creator.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "DoiT Cloud Intelligence",
    "description": "Programmatic access to DoiT Platform",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.doit.com"
    }
  ],
  "security": [
    {
      "api_key": []
    },
    {
      "tenantId": [],
      "api_key": []
    }
  ],
  "tags": [
    {
      "name": "Connections",
      "description": "Manage cloud provider connections used in CloudFlow workflows (AWS and GCP)."
    }
  ],
  "paths": {
    "/cloudflow/v1/connections": {
      "post": {
        "tags": [
          "Connections"
        ],
        "summary": "Create a connection",
        "description": "Creates a new cloud provider connection. Exactly one of `gcpConfig` or `awsConfig` must be supplied.\nReturns `400 invalid_connection_config` when both or neither are present.\n\nWhen `collaborators` lists no owner, the caller is added as the owner (or promoted to owner when\nalready listed), so a connection created without `collaborators` stays manageable by its creator.",
        "operationId": "createCloudflowConnection",
        "parameters": [
          {
            "$ref": "#/components/parameters/idempotencyKeyRequired"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Human-readable connection name."
                  },
                  "description": {
                    "type": "string",
                    "description": "Optional description."
                  },
                  "gcpConfig": {
                    "$ref": "#/components/schemas/CloudflowGCPConfigRequest"
                  },
                  "awsConfig": {
                    "$ref": "#/components/schemas/CloudflowAWSConfigRequest"
                  },
                  "collaborators": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/CloudflowCollaborator"
                    }
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "When false, the connection is created in a disabled state.",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudflowConnection"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CloudflowCollaborator": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "editor",
              "user"
            ]
          }
        }
      },
      "CloudflowGCPConfigRequest": {
        "type": "object",
        "description": "GCP connection configuration. Server-owned fields (status, deploymentCommand) are excluded.",
        "properties": {
          "organizationId": {
            "type": "string"
          },
          "folderId": {
            "type": "string"
          },
          "projectId": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "enum": [
              "organization",
              "folder",
              "project"
            ]
          },
          "serviceAccountName": {
            "type": "string"
          },
          "predefinedRoles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "customRole": {
            "type": "object",
            "properties": {
              "roleId": {
                "type": "string"
              },
              "permissions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "infraManagerProject": {
            "type": "string"
          },
          "infraManagerLocation": {
            "type": "string"
          },
          "infraManagerServiceAccount": {
            "type": "string"
          }
        }
      },
      "CloudflowAWSActionRequest": {
        "type": "object",
        "description": "A custom IAM action granted to the CloudFlow role.",
        "required": [
          "value"
        ],
        "properties": {
          "value": {
            "type": "string",
            "description": "IAM action, for example `s3:ListBucket`."
          }
        }
      },
      "CloudflowAWSPermissionsRequest": {
        "type": "object",
        "description": "IAM permissions granted to the CloudFlow role.",
        "properties": {
          "awsManagedPolicies": {
            "type": "array",
            "description": "AWS-managed policy ARNs attached to the role.",
            "items": {
              "type": "string"
            }
          },
          "actions": {
            "type": "array",
            "description": "Custom IAM actions.",
            "items": {
              "$ref": "#/components/schemas/CloudflowAWSActionRequest"
            }
          }
        }
      },
      "CloudflowAWSConfigRequest": {
        "type": "object",
        "description": "AWS connection configuration. Server-owned fields (context[].status, context[].nextStackOperation, stackSet) are excluded.",
        "properties": {
          "context": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "regions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "roleName": {
            "type": "string"
          },
          "permissions": {
            "$ref": "#/components/schemas/CloudflowAWSPermissionsRequest"
          },
          "managementAccount": {
            "type": "string"
          },
          "organizationRootId": {
            "type": "string"
          },
          "scopeTargetedOrganizationalUnitIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scopeExplicitAccountIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scopeExcludedAccountIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scopeManagementAccountExplicitInScope": {
            "type": "boolean"
          }
        }
      },
      "CloudflowConnection": {
        "type": "object",
        "description": "A cloud provider connection used in CloudFlow workflows.",
        "properties": {
          "connectionId": {
            "type": "string",
            "description": "Unique identifier for the connection."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "gcpConfig": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CloudflowGCPConfigRequest"
              },
              {
                "type": "object",
                "description": "Response extends request schema with server-owned read-only fields.",
                "properties": {
                  "status": {
                    "type": "string",
                    "description": "Server-managed GCP config status."
                  },
                  "deploymentCommand": {
                    "type": "string",
                    "description": "Generated deployment command."
                  }
                }
              }
            ]
          },
          "awsConfig": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CloudflowAWSConfigRequest"
              },
              {
                "type": "object",
                "description": "Response extends request schema with server-owned read-only fields.",
                "properties": {
                  "context": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "accountId": {
                          "type": "string"
                        },
                        "regions": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "status": {
                          "type": "string",
                          "description": "Server-managed per-account deployment status."
                        }
                      }
                    }
                  },
                  "permissions": {
                    "type": "object",
                    "description": "Response extends request schema with server-assigned action identifiers.",
                    "properties": {
                      "actions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string",
                              "description": "IAM action, for example `s3:ListBucket`."
                            },
                            "id": {
                              "type": "string",
                              "description": "Server-returned row identifier. Not used for permission evaluation."
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            ]
          },
          "collaborators": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CloudflowCollaborator"
            }
          },
          "enabled": {
            "type": "boolean",
            "description": "false when the connection is disabled."
          },
          "status": {
            "type": "string",
            "description": "Overall connection status."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "etag": {
            "type": "string",
            "description": "Current version of the connection. Send it unchanged in `If-Match` to update or delete."
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Standard error response structure.",
        "properties": {
          "error": {
            "type": "string",
            "description": "Detailed error message."
          }
        },
        "example": {
          "error": "The request could not be completed."
        }
      }
    },
    "responses": {
      "400": {
        "description": "Bad Request - The server cannot process the request, often due to a malformed request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "401": {
        "description": "Unauthorized - Invalid API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "403": {
        "description": "Forbidden - The client is not authorized to perform the request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "500": {
        "description": "Internal Server Error - Something went wrong with the DoiT API server.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "parameters": {
      "idempotencyKeyRequired": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Client-generated key (UUID v4 or ULID recommended). Retrying with the same key and request returns the stored response instead of repeating the operation; the key is kept for 24 hours.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "Authorization",
        "description": "Use the \"Bearer <API_KEY>\" format or sign in for autofill",
        "in": "header"
      },
      "tenantId": {
        "type": "apiKey",
        "name": "X-Tenant-Id",
        "description": "Customer (tenant) ID for the request. Separate from your API token: always authenticate with `Authorization: Bearer <token>` (personal or service account). See [Get Started](https://developer.doit.com/docs/start). Omit when your token is scoped to a single customer (resolved automatically). A service account can select an active direct or nested descendant of its home customer; the endpoint's normal permissions, entitlements, and resource-ownership checks still apply. A service-account target outside that customer subtree returns `403 Forbidden`. Prefer this header over the legacy `customerContext` query parameter, which only applies to legacy API keys and is ignored by personal and service account tokens.",
        "in": "header"
      }
    }
  },
  "x-samples-languages": [
    "curl",
    "go",
    "node",
    "python"
  ],
  "x-cli-config": {
    "security": "oauth2",
    "params": {
      "client_id": "cli"
    }
  }
}
```