API Users

The following REST routes are available to manage API users following the ongoing access use case

Using our knowledge from the authentication and client credentials documents, you can create an API User, and query on these users.

POST /users

Example request:

curl --request POST \
  --url http://identity.moneyhub.co.uk/users \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWRpZW5jZSI6IjMwY2E3MzFiOTFlYWU2NTA3MDUzZTc2NmM4Yjk2ZGQzNGI3NDJkMzI3NmUzYzU2MDI1NWY3MjRlNmFlMDU1NTMiLCJzY29wZSI6ImFwaS11c2Vycy5yZWFkLmFsbCBhcGktdXNlcnMud3JpdGUuYWxsIiwiZXhwIjoxNTQyNzA0NjM1LCJ0eXBlIjoiYXBwbGljYXRpb24tdG9rZW4iLCJpYXQiOjE1NDI3MDM3MzUsImp0aSI6IjEzM2Y4YWQ3ZmI4MGY2NzUifQ.PJLrpqDMA_Oua0vwwOV5lP_cex_-KamJzhLpdg7Q15Y' \
  --header 'content-type: application/json' \
  --data '{
    "clientUserId": "some-id"
}'

Example response:

{
    "clientUserId": "some-id",
    "userId": "328278302947678c0fc37f54",
    "clientId": "898c529b-c062-4f26-a136-fd8bc462d583",
    "scopes": "user:create",
    "managedBy": "client"
}

This allows an API client to create a new “user”. Once this user has been created the following operations are possible:

  • starting an authorisation flow to connect a financial provider to that user
  • gaining an access token for that user
  • using that access token to get and create financial resources for that user

This route requires an access token from the client credentials grant with the scope of user:create.

It accepts a JSON body with a single parameter: clientUserId. This is optional but allows an API cilent to persist it’s own identifier against the user.

GET /users

This route requires an access token from the client credentials grant with the scope of user:read. It returns an array of all the users associated with your api client.

Query ParmetersTyoeDescription
limitnumberSet the number of records to be retrieved (Default: 100)
offsetnumberBy specifying offset, you retrieve a subset of records starting with the offset value (Default: 0)

GET /users/:id

This route requires an access token from the client credentials grant with the scope of user:read. It returns a single user associated with your api client.

GET /users/:id/connections

Example request using moneyhub api client

const connections = await moneyhub.getUserConnections("user-id")

Example response

{
    "data": [
        {
            "id": "b74f1a79f0be8bdb857d82d0f041d7d2:567da9db-7296-4dc0-8a99-7b20dea8d21f",
            "name": "Modelo Open Banking Mock",
            "type": "test",
            "connectedOn": "2019-09-27T14:29:43.687Z",
            "lastUpdated": "2019-09-27T14:30:30.284Z",
            "expiresAt": "2019-12-26T14:29:30.715Z",
            "accountIds": [
                "10c6e372-64a4-4d80-add1-ba8549d668ed"
            ],
            "status": "ok",
            "error": null,
        },
        {
            "id": "3c4637d3178c9a28ce655bfbf8e27a10:ae9cf42a-2fcb-40f1-a1ad-da0a5f1beed5",
            "name": "Aviva",
            "type": "legacy",
            "connectedOn": "2019-09-23T18:29:43.687Z",
            "lastUpdated": "2019-09-23T18:30:30.284Z",
            "expiresAt": "2019-12-22T12:29:30.715Z",
            "accountIds": [
                "ee429506-5565-4ee9-9c31-e375283c0497"
            ],
            "status": "ok",
            "error": null,
        },
        {
            "id": "b74f1a79f0be8bdb857d82d0f041d7d2:6fbebd5e-fb2a-4814-bdaf-9a8871167f43",
            "name": "Nationwide Open Banking",
            "type": "api",
            "connectedOn": "2019-09-27T14:28:47.072Z",
            "lastUpdated": "2019-09-27T14:29:34.792Z",
            "expiresAt": "2019-12-26T14:27:51.576Z",
            "accountIds": [
                "11b6f582-3013-4c71-8af3-9c2d83444c14"
            ],
            "status": "error",
            "error": "resync"
        }
    ],
    "meta": {}
}

This route requires an access token from the client credentials grant with the scope of user:read. It gets information about all financial connections of a user.

https://docs.moneyhubenterprise.com/docs/connection-status

DELETE /users/:id/connection/:connection-id

This route requires an access token from the client credentials grant with the scope of user:delete. It deletes a financial connection of a user. This will revoke the grant that the user provided previously and it will delete any data associated with it from our API. (e.g. accounts, transactions)

DELETE /users/:id

This route requires an access token from the client credentials grant with the scope of user:delete. It deletes a user and all of its financial connections that were created.