Credential:  
None
  • None
  • Manage Credentials
Launch IDE ↗

Getting Started

2.2. Making Your First Query

While we do recommend reading both the Stitch SSO and Stitch API sections, they're probably easier to understand once you have dipped your toes in the water and made an API query or two using the GraphQL widgets embedded in our documentation.

Making a query requires that you first add a credential using Stitch SSO.

Adding a Credential

To start making queries, you'll need to add a credential. Click the ● Manage Credentials button at the top of the screen, and the credential management dialogue will open. At the bottom, you'll have the option to Add Test User. This allows you to add a simulated user bank account.

Clicking the Add Test User button will redirect you to a login page. Here you can sign in to a bank account and select which accounts and permissions to grant.

For test users, we have a standard username, PIN and password for all banks. These test details also appear in a banner above the login interface.

Test User Credentials
FieldValue
Usernameuser_test
Passwordpassword
PIN1234

After you've correctly entered your bank login details, you'll be redirected back to the docs, and have an opportunity to name your newly created credential.

Your first query

Now that we have a credential connected, we can make our first query to the Stitch API.

The Stitch API uses the GraphQL query language. GraphQL allows us to specify what data we want back from the API in a flexible and consistent manner.

Let's keep it simple for now and just get back a list of names of all the bank accounts linked to our user credential.

Try click Run in the GraphQL Widget below:

Congrats! You just made your first query! You should have received back a list of names of the linked bank accounts.

If this is your first time using GraphQL, the above query may seem intimidating. However, if you break the syntax down, it starts to look more intuitive:

  • We're making a query, called GetAccounts.
  • The top level of the query is on a user.
  • Then we are looking at all the bankAccounts the user has.
  • And finally, we are fetching the name of each account.

Let's try another one. This time, let's get the name, currentBalance and accountType.

Challenge

Here's a blank widget. Try to return the name, accountNumber, branchCode and id for each account.

Hint: Try type through the query instead of pasting an old one in. As you type, the widget will begin to autocomplete suggestions of fields available. You can also press Ctrl+Space to manually bring up the code-completion window.

Solution (don't peek)
1query GetAccounts {
2 user {
3 bankAccounts {
4 name
5 accountNumber
6 branchCode
7 id
8 }
9 }
10}

Next steps

Of course Stitch and GraphQL can do much more than simply retrieving accounts and balances. The rest of these docs aim to help you achieve the most out of the Stitch Platform.