SFTP Connections API
This API provides comprehensive functionality for managing SFTP connections and performing file operations on remote SFTP servers. It is part of the Borrower Central system and requires proper authentication and authorization.
Base URL
All endpoints are prefixed with /store-sftp-connections
Authentication & Authorization
All endpoints require authentication via the validate_request_v2 mechanism and specific permissions:
- secrets.read: Required for read operations (listing, downloading, viewing connection details)
- secrets.write: Required for write operations (creating connections, uploading, deleting, moving files)
- secrets.delete: Required for deleting connections
The SFTPConnection Object
The SFTPConnection object represents an SFTP connection configuration in the system.
Attributes
| Attribute | Description | Type |
|---|---|---|
| id | Unique identifier of the connection | String |
| host | SFTP server hostname or IP address | String |
| label | Human-friendly name for the connection | String |
| tenant | Tenant identifier | String |
| createdAt | Date and time when connection was created | String (ISO 8601) |
| updatedAt | Date and time of last update | String (ISO 8601) |
Available Operations
Create a new SFTP Connection
Creates a new SFTP connection configuration.
Input Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
| label | Human-friendly name for the connection | String | Yes |
| host | SFTP server hostname or IP address | String | Yes |
| port | Port number (default: 22, range: 1-65535) | Integer | No |
| username | SFTP username | String | Yes |
| password | SFTP password | String | Yes |
Request Example
Successful Response
Get an SFTP Connection
Retrieves details of a specific SFTP connection.
Path Parameters
| Parameter | Description |
|---|---|
| :connection_id | Unique identifier of the SFTP connection |
Successful Response
Returns the complete SFTPConnection object.
List SFTP Connections
Retrieves a paginated list of SFTP connections with search and sorting capabilities.
Query Parameters
| Parameter | Description | Type |
|---|---|---|
| search | Text query to search connections | String |
| page | Page number (default: 1) | Integer |
| per-page | Items per page (default: 10) | Integer |
| sort-by | Field to sort by | String |
| sort-direction | Sort direction (asc or desc) | String |
Successful Response
Paginated list of SFTPConnection objects.
Test an SFTP Connection
Tests the connectivity and authentication of an SFTP connection.
Path Parameters
| Parameter | Description |
|---|---|
| :connection_id | Unique identifier of the SFTP connection |
Successful Response
Delete an SFTP Connection
Permanently deletes an SFTP connection configuration.
Path Parameters
| Parameter | Description |
|---|---|
| :connection_id | Unique identifier of the SFTP connection |
Successful Response
Status code 204 (No Content) if deletion was successful.
File Operations
List Directory Contents
Lists files and directories at the specified path on the SFTP server.
Path Parameters
| Parameter | Description |
|---|---|
| :connection_id | Unique identifier of the SFTP connection |
Query Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
| path | Remote path to list (e.g., /home/user/docs) | String | Yes |
Successful Response
Download File
Downloads a file from the SFTP server and creates a store package.
Path Parameters
| Parameter | Description |
|---|---|
| :connection_id | Unique identifier of the SFTP connection |
Input Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
| path | Path to the remote file | String | Yes |
Request Example
Successful Response
Download File (Direct URL)
Downloads a file from the SFTP server and returns a direct download URL.
Path Parameters
| Parameter | Description |
|---|---|
| :connection_id | Unique identifier of the SFTP connection |
Input Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
| path | Path to the remote file | String | Yes |
Request Example
Successful Response
Upload File
POST /store-sftp-connections/{connection_id}/upload
Uploads a file from an attachment to the SFTP server.
Request Body:
Fields:
attachmentId(string, required): ID of the attachment to uploadremotePath(string, optional): Remote directory path (defaults to root)filename(string, optional): Custom filename (uses original if not provided)
Response: 201 Created
Get File/Directory Information
POST /store-sftp-connections/{connection_id}/stat
Retrieves detailed information about a file or directory.
Request Body:
Response: 200 OK
Create Directory
POST /store-sftp-connections/{connection_id}/mkdir
Creates a new directory on the SFTP server.
Request Body:
Fields:
path(string, required): Path of the directory to createmode(integer, optional): Directory permissions in octal format (default: 755)
Response: 201 Created
Delete File/Directory
POST /store-sftp-connections/{connection_id}/delete-file
Deletes a single file or directory from the SFTP server.
Request Body:
Response: 200 OK
Bulk Delete Files
POST /store-sftp-connections/{connection_id}/bulk-delete
Deletes multiple files or directories from the SFTP server.
Request Body:
Fields:
paths(array, required): List of paths to delete (1-50 items)
Response: 200 OK
Move/Rename File
POST /store-sftp-connections/{connection_id}/move
Moves or renames a file or directory on the SFTP server.
Request Body:
Response: 200 OK
Copy File
POST /store-sftp-connections/{connection_id}/copy
Copies a file or directory on the SFTP server.
Request Body:
Response: 200 OK
Error Handling
The API can return the following error codes:
| Code | Description |
|---|---|
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
Errors include a descriptive message in the response body.
Rate Limits
- Bulk delete operations are limited to 50 paths per request
- File operations may have size limits depending on server configuration
- Connection testing should be used sparingly to avoid server overload
Security Considerations
- All credentials are encrypted at rest
- SFTP connections use secure authentication mechanisms
- File operations are restricted to the authenticated user's accessible directories
- All operations are logged for audit purposes
- Temporary download URLs have expiration times for security