Skip to main content
  1. Data-recipients/

Retrieve customer data

2 mins

The following steps are outlined and supported with an accompanying Postman collection. Postman is an API Platform for developers to design, build, test and iterate their APIs running on Windows, Mac and Linux.

This can be used to validate your API calls. You will be supplied three credentials for access to the Wych Data API, an API key x-api-key, client_id and client_secret. The Postman collection is supported with the API docs.

Read more about access credentials and how to authenticate.

Find the user #

Find the user whose data you wish to access. The ID associated with this users is used in the next step.

Does the user exist? You can check list all users at the /users endpoint.

GET /partner/{partnerId}/app/{appId}/users

curl --location 'https://api.wych.io/v3/partner/{partnerId}/app/{appId}/users' \
--header 'x-api-key: apixxxxxkey' \
--header 'Authorization: Bearer eyJxxxxg2Q'

[
    {
        "id": "c6xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx92",
        "email": "test-user@example.com"
    },
    {
        "id": "00xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx0d",
        "email": "another-user@example.com"
    }
]

Alternatively you can query by user email address at the /user endppoint.

POST /partner/{partnerId}/app/{appId}/user

curl --location 'https://api.wych.io/v3/partner/{partnerId}/app/{appId}/user' \
--header 'x-api-key: apixxxxxkey' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJxxxxg2Q'
--data-raw '{
    "email": "a.new-user@example.com"
}'

{
    "id": "a1xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxb2",
    "email": "a.new-user@example.com"
}'

Set the user in context #

You can now set the user in context. The remaining commands will be performed with a user context token.

This is a token exchange, swapping your service token for a token locked to the customer whose details you wish to extract. Set the userId in the URL path /user/{userId}/token. You will be returned an auth_token which must be used for the following user context queries.

POST /partner/{partnerId}/app/{appId}/user/{userId}/token

curl --location 'https://api.wych.io/v3/partner/{partnerId}/app/{appId}/user/{userId}/token' \
--header 'x-api-key: apixxxxxkey' \
--header 'Authorization: Bearer eyJxxxxg2Q'

{
    "access_token": "eyXXXXXXzA",
    ...
}

List user’s accounts #

Using the user context access_token you can now request the accounts associated with the selected user.

GET /accounts

curl --location 'https://api.wych.io/v3/accounts' \
--header 'x-api-key: apixxxxxkey' \
--header 'Authorization: Bearer eyJxxxxg2Q'

[
    {
        "id": "5bxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxfa",
        "dataholder": "b5xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx2f",
        "user": "00xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx0d",
        "app": "{app_name}",
        "connection": "15xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxb5",
        "currency": "AUD",
        "externalId": "2dxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx3c",
        "type": "PERSONAL",
        "subtype": "CURRENTACCOUNT",
        "name": ...,
        "nickname": ..,
        "accountNumber": [
            ...
        ]
    }
]

Get transactions for an account #

curl --location 'https://api.wych.io/v3/account/{accountId}/transactions' \
--header 'x-api-key: apixxxxxkey' \
--header 'Authorization: Bearer eyJxxxxg2Q'

[
    {
        "id": "27xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxbe",
        "account": "5bxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxfa",
        "reference": "",
        "type": "DEBIT",
        "status": "PENDING",
        "amount": {
            "amount": -10.86,
            "currency": "AUD"
        },
        ...
        "datetime": "XXXX-XX-XXT15:07:10Z",
        "externalId": "wKxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxCc",
        "code": "5734",
        "thirdParty": {
            "id": "61xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx1d",
            "name": "Some business",
            ...
        },
        "description": "A transaction description",
        "category": "Retail",
        "subcategory": "Grocery Store",
        "budgetCategory": "Groceries",
        "budgetSubcategory": "NEED"
    },
    ...
]