Simple universal SDK for easy consumption of OP APIs.
npm install @op/api-sdk
import SDK from "@op/api-sdk";
const options = {
headers: {
'x-api-key': 'your-api-key',
}
}
const client = new SDK.Client(options)
See requests for required headers.
You can set request options for client instance, and also for each request function call, which is useful because you can then use global instance of SDK client, with globally defined x-api-key, but still give separate x-authorization header for each user:
const userOptions = {
headers: {
'x-authorization': userSession.getAuthorizationKey({bank: "OP"})
}
}
const accounts = await client.getAllAccounts(userOptions);
For further reading, please see our API documentation
- register at https://op-developer.fi/developers/register
- create an app that has access to all sandbox products (Mobility, Banking, etc)
- run tests with
X_API_KEY=<your api key> npm run test