Skip to main content

Update Data Source Credentials

Sprint 3

Update credentials for a data source. This endpoint allows updating credentials separately from other configuration.

Endpoint

PATCH /api/v1/data-sources/{data_source_id}/credentials

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>
Content-TypeYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
data_source_idintegerYesData source ID

Request Body

{
"username": "newuser",
"password": "newpassword",
"rotate_credentials": false
}

Parameters

All fields are optional. Only provided fields will be updated.

FieldTypeRequiredDescription
usernamestringNoDatabase username
passwordstringNoDatabase password
api_keystringNoAPI key for API-based sources
oauth_tokenstringNoOAuth token
ssh_private_keystringNoSSH private key for tunnel
ssh_passphrasestringNoSSH key passphrase
rotate_credentialsbooleanNoRotate credentials flag (default: false)

Response

Success (200)

{
"success": true,
"data": {
"data_source_id": 1,
"credentials_updated_at": "2024-12-01T11:00:00Z"
},
"message": "Credentials updated successfully"
}

Error Codes

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENUser is not a member of any organization
404NOT_FOUNDData source not found

Features

  • Separate endpoint for credential updates
  • Credentials are encrypted at rest
  • Partial updates supported
  • Organization-scoped access control

Example

curl -X PATCH "https://api.rivergen.com/api/v1/data-sources/1/credentials" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"username": "newuser",
"password": "newpassword"
}'