# "Missing or invalid scopes" when create funding source for master account in sandbox

**URL:** <https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852>\
**Category:** API Support\
**Created:** [June 11, 2020, 5:29pm UTC](https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852 "2020-06-11T17:29:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrey\_Kaloshin](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/andrey_kaloshin/32/2436_2.png) [@Andrey\_Kaloshin](https://discuss.dwolla.com/u/Andrey_Kaloshin)\
**Post date:** [June 11, 2020, 5:29pm UTC](https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852/1 "2020-06-11T17:29:26Z")

</div>

Hi! I’m trying to add funding source for master account in sandbox.  
i do:  
const url = ‘[https://api-sandbox.dwolla.com/funding-sources](https://api-sandbox.dwolla.com/funding-sources)’  
(url from here [https://docs.dwolla.com/#create-a-funding-source-for-an-account](https://docs.dwolla.com/#create-a-funding-source-for-an-account))

this.dwolla = new dwolla.Client(config); //key,secret,env=sandbox  
this.dwolla.auth.client()  
.then((token) =\> {  
token.post(url, data).then… //name,accountNum etc

but i get "Missing or invalid scopes for requested endpoint.”

What did i do wrong?

Thank you in advance,  
Andrey

---

<div class="post-metadata">

**Author:** ![shreya](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/shreya/32/2154_2.png) [@shreya](https://discuss.dwolla.com/u/shreya)\
**Post date:** [June 11, 2020, 9:12pm UTC](https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852/2 "2020-06-11T21:12:26Z")

</div>

Hi @Andrey_Kaloshin – would you be able to post your Account ID or any ID related to your Sandbox account for us to take a look? Also, if you have the request-id for this request that returned the above error, that would help too!

Thanks!

---

<div class="post-metadata">

**Author:** ![Andrey\_Kaloshin](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/andrey_kaloshin/32/2436_2.png) [@Andrey\_Kaloshin](https://discuss.dwolla.com/u/Andrey_Kaloshin)\
**Post date:** [June 12, 2020, 8:03am UTC](https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852/3 "2020-06-12T08:03:53Z")

</div>

Hi @shreya, account # is “bbcbc7b1-81ec-46cc-8316-3180451b770c”

and from headers:  
x-request-id: (1) [‘da1a2ebd-1817-4134-b3b4-e214a099eb07’]

Andrey,  
BR

---

<div class="post-metadata">

**Author:** ![shreya](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/shreya/32/2154_2.png) [@shreya](https://discuss.dwolla.com/u/shreya)\
**Post date:** [June 12, 2020, 2:06pm UTC](https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852/4 "2020-06-12T14:06:05Z")

</div>

Hi @Andrey_Kaloshin, thanks for the IDs! I was able to look up the request body, and it seems that the error has to do with the `routingNumber` and `accountNumber` values that were provided.

> “routingNumber”: “dasdas”,  
> “accountNumber”: “123”,

If you update the values according to the specs defined in [this section](https://docs.dwolla.com/#create-a-funding-source-for-a-customer) of our API reference docs, the request should pass successfully. Here’s an example request-body that works -

```auto
{
    "routingNumber": "222222226",
    "accountNumber": "123456789",
    "bankAccountType": "checking",
    "name": "My Bank"
}

```

Having said that, for the above error, the error type that should have been returned is a **`BadRequest`** error and not an **`InvalidScope`** error. I can create a ticket for our team to update the error message returned. Thanks for bringing this to our attention!

---

<div class="post-metadata">

**Author:** ![Andrey\_Kaloshin](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/andrey_kaloshin/32/2436_2.png) [@Andrey\_Kaloshin](https://discuss.dwolla.com/u/Andrey_Kaloshin)\
**Post date:** [June 17, 2020, 9:35am UTC](https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852/5 "2020-06-17T09:35:35Z")

</div>

Yes, i didn’t validate input yet, it’s just a test run; and yes, i expected BadRequest for return. Thank you @shreya!

BR,  
Andrey

---

<div class="post-metadata">

**Author:** ![francopetra](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/francopetra/32/2695_2.png) [@francopetra](https://discuss.dwolla.com/u/francopetra)\
**Post date:** [October 22, 2020, 11:46pm UTC](https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852/6 "2020-10-22T23:46:52Z")

</div>

Hi @shreya, I have the same error for the same endpoint but using Plaid + dwolla-v2 (node).

```auto
    const params = {
      plaidToken: plaidToken,
      name: name
    }

    dwolla
      .post("funding-sources", params)
            .then((response) => {
             ...

```

I know I need to put the customer id or link somewhere, but not sure where, or even if this is supported by the library. Thanks!

---

<div class="post-metadata">

**Author:** ![spencer](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/spencer/32/2143_2.png) [@spencer](https://discuss.dwolla.com/u/spencer)\
**Post date:** [October 23, 2020, 12:09pm UTC](https://discuss.dwolla.com/t/missing-or-invalid-scopes-when-create-funding-source-for-master-account-in-sandbox/5852/7 "2020-10-23T12:09:34Z")

</div>

> [@francopetra](#):
>
> ```auto
> dwolla
> .post("funding-sources", params)
> 
> ```

@francopetra, you should be able to do something like the following:

```auto
const customerA = 'https://api-sandbox.dwolla.com/customers/07d59716-ef22-4fe6-98e8-f3190233dfb8;
const params = {
      plaidToken: plaidToken,
      name: name
    };

dwolla
  .post(`${customerA}/funding-sources`, params)
 .......

```

Looks like you just need to update the request URL to include the Customer you’re adding a funding source to. Let us know if that works for you!
