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
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Content-Type | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
data_source_id | integer | Yes | Data source ID |
Request Body
{
"username": "newuser",
"password": "newpassword",
"rotate_credentials": false
}
Parameters
All fields are optional. Only provided fields will be updated.
| Field | Type | Required | Description |
|---|---|---|---|
username | string | No | Database username |
password | string | No | Database password |
api_key | string | No | API key for API-based sources |
oauth_token | string | No | OAuth token |
ssh_private_key | string | No | SSH private key for tunnel |
ssh_passphrase | string | No | SSH key passphrase |
rotate_credentials | boolean | No | Rotate 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
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 403 | FORBIDDEN | User is not a member of any organization |
| 404 | NOT_FOUND | Data 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"
}'
Related Endpoints
- Update Data Source - Update other data source configuration
- Test Connection - Test connection with new credentials