# Quickstart

NexumAPI provides a RESTful interface for developers to interact with their Symitar data using their existing SymXchange instances.

{% hint style="success" %}
**Want to jump straight to the code?**

Skip the quickstart and dive into the [SymXchange API reference](/nexum/symxchange/api-reference.md).
{% endhint %}

This quickstart is designed to help you make your first API request on the NexumAPI Playground. If you're an experienced developer or want to just dive into using NexumAPI, the [API reference](/nexum/symxchange/api-reference.md) is a great place to start. Throughout this quickstart, you will learn:

* How to get access to the NexumAPI Playground
* Overview of some of the basic concepts of NexumAPI
* How to send your first API request

If you run into any challenges or have questions getting started, please join our [Libum Community](https://discord.gg/libum) on Discord.

## Accessing the playground

We've created a playground environment to give credit union developers an immediate first look at NexumAPI. First, tag a Libum Team Member in the <mark style="color:blue;">**#api-key-requests**</mark> channel on our [Libum Community](https://discord.gg/libum) server with your email alias (if you don't have Discord, reach out to our team at <development@libum.io>).

## Making your first request

Select the tool or language you want to get started using the NexumAPI Playground with. The NexumAPI Playground is provided as a ready-to-use service called NexumAPI as a Service or "NaaS" meaning ultimately it's language agnostic.

{% tabs %}
{% tab title="Node.js" %}
Node.js is a popular JavaScript framework that is commonly used for web development. We'll use the popular [node-fetch](https://www.npmjs.com/package/node-fetch) library to make light weight requests to NaaS.

**Install Node.js**

To use [node-fetch](https://www.npmjs.com/package/node-fetch) to make a NexumAPI call, you will need to ensure you have Node.js installed. To download Node.js, head to the [official Node website](https://nodejs.org/en/download) and download the LTS version. If you're installing Node.js for the first time, you can follow the [official Node.js usage guide](https://nodejs.org/api/synopsis.html#usage) to get started

**Install the node-fetch library**

Once you have Node.js installed, the node-fetch library can be installed. From the terminal / command line, run:

```bash
npm install --save node-fetch
# or
yarn add node-fetch
```

**Set up your API key**

Follow the below steps for your OS to make your API key accessible for this and all future projects.

**macOS**

1. **Open Terminal:** Search for it using Spotlight (Command + Space)
2. **Edit bash profile:** Use the command <mark style="color:purple;">`nano ~/.bash_profile`</mark> or <mark style="color:purple;">`nano ~/.zshrc`</mark> (for newer macOS versions) to open the profile file in the [nano](https://www.nano-editor.org/) text editor.
3. **Add Environment Variable:** In the editor, add <mark style="color:purple;">`export NEXUM_API_KEY='your-api-key-here'`</mark>, replacing <mark style="color:purple;">`your-api-key-here`</mark> with your actual API key.
4. **Save and exit:** Press Ctrl+O to write changes, followed by Ctrl+X to close the editor.
5. **Load your profile:** Use the command <mark style="color:purple;">`source ~/.bash_profile`</mark> or <mark style="color:purple;">`source ~/.zshrc`</mark> to load the updated profile.
6. **Verification:** Verify the setup by typing `echo $NEXUM_API_KEY` in the terminal. It should display your API key.

**Windows**

1. **Open command prompt:** You can find it by searching "cmd" in the start menu.
2. **Set permanent environment variable:** Add the variable through the system properties as follows:
   1. Right-click on *This PC* or *My Computer* and select *Properties*.
   2. Click on *Advanced system settings*.
   3. Click the *Environment Variables* button
   4. In the *System variables* section, click *New\..* and enter <mark style="color:purple;">`NEXUM_API_KEY`</mark> as the variable name and your API key as the variable value
3. **Verification:** To verify the setup, open a new command prompt and type the command below: <mark style="color:purple;">`echo %NEXUM_API_KEY%`</mark>, it should display your API key.

**Sending an API request**

After you have Node.js configured and set up an API key, the final step is to send a request to the NexumAPI Playground. To do this, create a file named <mark style="color:purple;">`naas-test.js`</mark> using the terminal / command line or an IDE.

Inside the file, copy and paste the example below:

```javascript
import fetch from 'node-fetch';

const body = {
    "AccountNumber": "13824",
    "Credentials": {
        "AdministrativeCredentials": {
            "Password": "suwn37834b91&"
        }
    }
};
const response = await fetch('https://naas.ymcu.libum.io/nexum/627/2022.01/account/getAccount', {
    method: 'POST',
    headers: {
        "Authorization": `Bearer ${process.env.NEXUM_API_KEY}`,
        "Content-Type": "application/json",
    },
    body: JSON.stringify(body),
});
const data = await response.json();

console.log(data);
```

To run the code, enter <mark style="color:purple;">`node naas-test.js`</mark> into the terminal / command line. You should see the following in the console:

```json
{
    "Account": {
        "ActivityDate": "2010-04-25",
        "AlternateAddress": [
            {
                "AlternateAddress": "SETH A ZAMORA",
                "EntryId": "1"
            },
            {
                "AlternateAddress": "8479 M ST",
                "EntryId": "2"
            },
// ...
```

{% endtab %}

{% tab title="Postman" %}
Postman is an API platform that can be used to quickly test request payloads against an API. We'll create a sample <mark style="color:purple;">`POST`</mark> request to NaaS.

**Install Postman**

Postman can be accessed through the browser of your choice or can be downloaded using their [official downloads page](https://www.postman.com/downloads/).

**Set up your API key**

Follow the steps below to persist your API key across any request through the use of *Environments* in Postman.

1. Navigate to the *Environments* tab and select *Globals*.
2. Add a new Variable, <mark style="color:purple;">`nexum_api_key`</mark> and set both the <mark style="color:purple;">`Initial value`</mark> and <mark style="color:purple;">`Current value`</mark> to your API key.

   <figure><img src="/files/h4wCI4yz3ANLF167GRMe" alt=""><figcaption><p>Global environment variables on the Environments tab in Postman.</p></figcaption></figure>
3. You can now access your API key anywhere in Postman via <mark style="color:purple;">`{{nexum_api_key}}`</mark>.

**Sending an API request**

If you haven't already, create a *Collection* for all your NexumAPI Playground requests and configure the *Authorization* tab to set a Bearer token for every request like the following:

<figure><img src="/files/wNsjCdhShSdmdKM6gR6Z" alt=""><figcaption><p>Setting Bearer Token authorization to use API key within a Collection on the NexumAPI Playground workspace in Postman.</p></figcaption></figure>

Next, you can select *Add a request* with the following attributes:

* **Method:** <mark style="color:purple;">`POST`</mark>
* **URL:** <mark style="color:purple;">`https://naas.ymcu.libum.io/nexum/627/2022.01/account/getAccount`</mark>
* **Body:** Select <mark style="color:purple;">`raw`</mark> and <mark style="color:purple;">`JSON`</mark> and paste the following block:

```json
{
    "AccountNumber": "13824",
    "Credentials": {
        "AdministrativeCredentials": {
            "Password": "suwn37834b91&"
        }
    }
}
```

Finally, click *Send* and you should receive the following response:

```json
{
    "Account": {
        "ActivityDate": "2010-04-25",
        "AlternateAddress": [
            {
                "AlternateAddress": "SETH A ZAMORA",
                "EntryId": "1"
            },
            {
                "AlternateAddress": "8479 M ST",
                "EntryId": "2"
            },
// ...
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.libum.io/nexum/quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
