Skip to content

Create a new database connection

Request

OPA roles:
  • resource_admin

Creates a new database connection for the specified team

Security
bearerAuth
Path
team_namestringrequired

The name of your team

Bodyapplication/jsonrequired
auth_detailsanyrequired
auth_typestring(DatabaseAuthType)required

The authentication type for the database connection

Enum ValueDescription
postgres_basic_auth

Username and password for PostgreSQL database connection

mysql_basic_auth

Username and password for MySQL database connection

descriptionstring, <= 1000 characters

A description of the database connection

infrastructure_orchestratorobject(NamedObject)required

The infrastructure orchestrator to associate with this database connection

namestring, [ 1 .. 255 ] charactersrequired

The name for the database connection

POST
/v1/teams/{team_name}/connections/databases
curl -i -X POST \
  'https://{org_name}.pam.okta.com/v1/teams/{team_name}/connections/databases' \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Production PostgreSQL",
    "description": "Primary production database",
    "auth_type": "postgres_basic_auth",
    "auth_details": {
      "_type": "postgres_basic_auth",
      "username": "admin_user",
      "host": "db.example.com",
      "port": 5432,
      "password_jwe": "eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0..."
    },
    "infrastructure_orchestrator": {
      "id": "550e8400-e29b-41d4-a716-446655440000"
    }
  }'

Responses

Created

Bodyapplication/json
auth_detailsanyread-onlyrequired
auth_typestring(DatabaseAuthType)required

The authentication type for the database connection

Enum ValueDescription
postgres_basic_auth

Username and password for PostgreSQL database connection

mysql_basic_auth

Username and password for MySQL database connection

created_atstring, (date-time)read-onlyrequired

A UTC timestamp that indicates when the database connection was created

descriptionstringread-only

A description of the database connection

idstring, (regex)(UUID)^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-...read-onlyrequired

The UUID of the database connection

Example:"a747a818-a4c4-4446-8a87-704216495a08"
last_discovery_run_atstring or null, (date-time)read-only

A UTC timestamp that indicates when the last discovery scan was performed

last_status_change_atstring, (date-time)read-only

A UTC timestamp that indicates when the status was last changed

namestringread-onlyrequired

The name for the database connection

statusstring(DatabaseConnectionStatus)read-onlyrequired

The current status of the database connection

Enum ValueDescription
active

The connection is healthy and operational

warning

The last management tasks failed with soft errors, such as temporary network or permission issues

failed

The connection experienced an unrecoverable error such as invalid credentials or misconfiguration

marked_for_deletion

The connection has been marked for deletion and is pending cleanup

updated_atstring, (date-time)read-onlyrequired

A UTC timestamp that indicates when the database connection was last updated

infrastructure_orchestratorobject(NamedObject)read-onlyrequired

The infrastructure orchestrator associated with this database connection

Response
{ "id": "a747a818-a4c4-4446-8a87-704216495a08", "name": "Production PostgreSQL", "description": "Primary production database", "auth_type": "postgres_basic_auth", "auth_details": { "_type": "postgres_basic_auth", "username": "admin_user", "host": "db.example.com", "port": 5432 }, "status": "active", "last_status_change_at": "2024-01-15T10:30:00Z", "last_discovery_run_at": "2024-01-15T11:00:00Z", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-15T10:30:00Z", "infrastructure_orchestrator": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "rg-1" } }