plaid

Plaid /institutions/get/ doesn't seem to respect country_codes


I am new to Plaid, and just trying to get the basics working, but I've immediately hit an issue.

I can't (don't want to) use the "out of the box" link SDK (see this github issue), so I'm trying to implement my own UX that does broadly the same thing.

The documentation for the "institutions" endpoint, has the following sample API request:

curl -X POST https://sandbox.plaid.com/institutions/get \
-H 'Content-Type: application/json' \
-d '{
  "client_id": "${PLAID_CLIENT_ID}",
  "secret": "${PLAID_SECRET}",
  "count": Number,
  "offset": Number,
  "country_codes": Array
}'

If I execute this, either via curl or via a tool like Postman, I do indeed get results, but not what I expect. Here is my curl:

curl -X POST https://sandbox.plaid.com/institutions/get \
-H 'Content-Type: application/json' \
-d '{
  "client_id": "REDACTED",
  "secret": "REDACTED",
  "offset": 0,
  "count": 10,
  "country_codes": ["US"]
}'

This returns successfully, but returns the following:

{
    "institutions": [
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122874",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Bourgogne Franche Comté",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122875",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Auvergne et Rhône-Alpes",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122876",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Rives de Paris",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122877",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Val de France",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122878",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - du Nord",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122879",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Sud",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122880",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Aquitaine Centre Atlantique",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122881",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Alsace Lorraine Champagne",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122882",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Occitane",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        },
        {
            "country_codes": [
                "FR"
            ],
            "credentials": [],
            "has_mfa": true,
            "input_spec": "unknown",
            "institution_id": "ins_122883",
            "mfa": [
                "code",
                "list",
                "questions",
                "selections"
            ],
            "mfa_code_type": "numeric",
            "name": "Banque Populaire - Grand Ouest",
            "oauth": true,
            "products": [
                "assets",
                "auth",
                "balance",
                "transactions",
                "signal",
                "identity_match",
                "income_verification",
                "identity",
                "payment_initiation",
                "processor_payments",
                "transfer"
            ],
            "routing_numbers": []
        }
    ],
    "request_id": "AVhWWp9iNUGsvRb",
    "total": 11837
}

As you can see, these are all French banks. It seems like the plaid API is not respecting the country_codes property of the request body.

Has anyone else got this to work? Is there some trick I need to know here?


Solution

  • OK, so after inspecting the request/response pairs of Plaid's Node.js client library, it seems you need to also supply a Plaid-Version header:

    curl -X POST https://sandbox.plaid.com/institutions/get \
    -H 'Content-Type: application/json' \
    -H 'Plaid-Version: 2020-09-14' \
    -d '{
      "client_id": "REDACTED",
      "secret": "REDACTED",
      "offset": 0,
      "count": 10,
      "country_codes": ["US"]
    }'
    

    This is documented in their API Versioning docs, but not actually used in the samples for their main API docs