JS SDK quickstart

Installation

Install the latest version of the SDK with Yarn:

Copy
Copied
yarn add rebilly-js-sdk

Or using npm:

Copy
Copied
npm install rebilly-js-sdk --save

Finding your API key (optional)

To use the JS SDK with Node.js, you will need to provide your secret API key. This is available in Rebilly in the Automations > API Keys menu.

Node environment variables

For added security your secret API key should be kept as a Node environment variable.

Finding your organization ID (optional)

If you want to perform a request to a specific organization (which you have access to), you need to provide an organization identifier. You can see all organization memberships by making a GET request to the profile endpoint

If you do not provide an organization ID to the API client, the User's default organization will be used.

In the below sample response, your organization ID is memberships[0].organization.id

Copy
Copied
{
    "id": "11111111-1111-1111-1111-111111111111",
    "firstName": "User",
    "lastName": "Name",
    "email": "user@domain.com",
    "memberships": [
        {
            "organization": {
                "id": "11111111-1111-1111-1111-111111111111",
                "name": "Organization Name",
                "createdTime": "2019-09-04T03:29:58+00:00"
            },
            "user": {
                "id": "11111111-1111-1111-1111-111111111111",
                "name": "User Name",
                "email": "user@domain.com"
            }
        }
    ]
}