Create connection

Creates a new connection for the specified database.

API Endpoint

POST /v1/connections

Authorization

OAuth2 workspace:admin, offline_access

Authorization Bearer

OAuth2 authentication

In: header

Scope: workspace:admin, offline_access

Request Body

application/json

TypeScript Definitions
Use the request body type in TypeScript.

{
  databaseId: string, // Match `^(db_)?([cC][^\s-]{8,}|[a-z0-9]+)$`
  name: string // Length `1 <= length`
}

Response Body

201 application/json

{
  "data": {
    "id": "string",
    "type": "connection",
    "url": "http://example.com",
    "name": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "kind": "postgres",
    "endpoints": {
      "direct": {
        "host": "string",
        "port": 0,
        "connectionString": "string"
      },
      "pooled": {
        "host": "string",
        "port": 0,
        "connectionString": "string"
      },
      "accelerate": {
        "host": "string",
        "port": 0,
        "connectionString": "string"
      }
    },
    "connectionString": "string",
    "directConnection": {
      "host": "string",
      "pass": "string",
      "user": "string"
    },
    "database": {
      "id": "string",
      "url": "http://example.com",
      "name": "string"
    },
    "host": "string",
    "pass": "string",
    "user": "string"
  }
}

401 application/json

{
  "error": {
    "code": "string",
    "message": "string",
    "hint": "string"
  }
}

404 application/json

{
  "error": {
    "code": "string",
    "message": "string",
    "hint": "string"
  }
}