SDK
Javascript
How to
Recipients
All Recipients

List All Recipients

This method allows you to retrieve a paginated list of all your recipients.

Method Signature

async listRecipients(params?: ListRecipientsParams): Promise<ListRecipientsResponse>

Parameters

params: ListRecipientsParams - An object with the following properties:

  • limit: number (optional) - Limit the number of recipients returned.
  • sort: string (optional) - Sort the recipients by a specific field. You can sort by createdAt or updatedAt. By default, recipients are sorted by createdAt. Add a hyphen (-) before the field for reverse order.
  • search: string (optional) - Search for a recipient by name or email.
  • country: string (optional) - Filter recipients by bank country.
  • currency: string (optional) - Filter recipients by bank currency.

Returns

Promise<ListRecipientsResponse> - An object containing the paginated list of recipients and metadata.

Example Usage

const recipients = await sdk.rampableRecipient.listRecipients({
   limit: 10,
   sort: '-createdAt',
   search: 'John'
});
console.log(recipients);

Response Example

{
    "docs": [
        {
            "name": "John Doe",
            "recipientType": "Individual",
            "email": "john.doe@example.com",
            "bank": [
                {
                    "accountName": "John Doe",
                    "bankName": "Example Bank",
                    "accountNumber": "12345678910",
                    "paymentCode": "EXAMPLE",
                    "currency": "USD",
                    "country": "UNITED STATES",
                    "achNumber": "1",
                    "fedwireNumber": "1",
                    "ibanNumber": "1",
                    "accountType": "Checking",
                    "_id": "XXXXXX"
                }
            ],
            "organizationId": "XXXXXX",
            "userId": "XXXXXX",
            "createdAt": "2023-09-27T09:47:58.526Z",
            "updatedAt": "2023-09-27T09:47:58.526Z",
            "address": "123 Main St",
            "city": "New York",
            "postCode": "10001",
            "reference": "EMPLOYEE-001",
            "id": "XXXXXX"
        }
        // ... more recipients
    ],
    "totalDocs": 1,
    "offset": 0,
    "limit": 10,
    "totalPages": 1,
    "page": 1,
    "pagingCounter": 1,
    "hasPrevPage": false,
    "hasNextPage": false,
    "prevPage": null,
    "nextPage": null
}
ℹ️

By default, a maximum of ten recipients are shown per page.

Additional Information

  • The sort parameter allows sorting by createdAt or updatedAt. Add a hyphen (-) before the field name for reverse order (e.g., -createdAt).
  • Use the search parameter to find recipients by name or email.
  • The response includes pagination metadata to help navigate through large sets of recipients.
  • You can filter recipients by their bank's country and currency using the respective parameters.

For more information, see the Rampable Recipients API Documentation (opens in a new tab).