fastify-xplaid
xplaid.items.searchInstitutions
Search for financial institutions by name, with optional filters for supported products and country.
xplaid.items.searchInstitutions
Searches for financial institutions by name, with optional filters for supported products and country.
Signature
fastify.xplaid.items.searchInstitutions(
query: string,
options?: {
countryCodes?: string[] // default: ["US"]
products?: string[]
count?: number
offset?: number
}
): Promise<{ institutions: Institution[]; requestId: string }>
Params
| Name | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Institution name search string (e.g. "chase", "wells"). |
options.countryCodes | string[] | No | ISO 3166-1 alpha-2 country codes. Defaults to ["US"]. |
options.products | string[] | No | Filter to institutions that support specific products. |
options.count | number | No | Number of results to return. |
options.offset | number | No | Pagination offset. |
Returns
{ institutions: Institution[]; requestId: string }
Each Institution in the array has the same shape as described in items.getInstitution:
| Field | Type | Description |
|---|---|---|
institution_id | string | Plaid institution ID. |
name | string | Institution display name. |
products | string[] | Supported Plaid products. |
country_codes | string[] | Countries this institution operates in. |
logo | string | null | Base64-encoded PNG logo. |
primary_color | string | null | Brand hex color. |
oauth | boolean | Whether this institution uses OAuth. |
url | string | null | Institution's website URL. |
Throws
[xPlaid] query is required and must be a non-empty string- Plaid API errors — shape:
{ message, statusCode, plaidError }.
Examples
Basic
const { institutions } = await fastify.xplaid.items.searchInstitutions("chase");
console.log(institutions.map((i) => i.name)); // ["Chase", ...]
Realistic
fastify.get("/institutions/search", async (request, reply) => {
const { q, products } = request.query;
if (!q || q.length < 2) return reply.status(400).send({ error: "Query too short" });
try {
const { institutions } = await fastify.xplaid.items.searchInstitutions(q, {
products: products ? products.split(",") : ["transactions"],
count: 10,
});
return institutions.map((inst) => ({
id: inst.institution_id,
name: inst.name,
logo: inst.logo,
color: inst.primary_color,
oauth: inst.oauth,
}));
} catch (error) {
if (error.plaidError) {
return reply.status(error.statusCode ?? 500).send({ error: error.message });
}
throw error;
}
});
See also
- items.getInstitution — Get full details for a specific institution by ID.
- items.get — Get Item status including linked institution ID.
- fastify-xplaid overview — Plugin setup and options.
AI Context
package: "@xenterprises/fastify-xplaid"
method: fastify.xplaid.items.searchInstitutions(query, options?)
use-when: Find financial institutions by name for UI search, Link customization, or filtering by supported products
returns: { institutions: Institution[], requestId }
