> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/o/oracle-netsuite.md).

# Oracle NetSuite

Oracle NetSuite is a cloud ERP. OctoXLabs reads employees through SuiteQL and adds them as users, with their admin status taken from role assignments.

## Use cases

* List NetSuite employees that OctoXLabs has collected.

```
Adapters = oracle-netsuite
```

## Before you begin

### Network

| Source              | Destination                                                                                  | Port | Protocol |
| ------------------- | -------------------------------------------------------------------------------------------- | ---- | -------- |
| OctoXLabs connector | `<account>.suitetalk.api.netsuite.com` (sandbox: `<account>-sb1.suitetalk.api.netsuite.com`) | 443  | HTTPS    |

### Required permissions

| Scope or role                                         | Permission                                                   | Needed for                                                                      |
| ----------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------- |
| OAuth 2.0 and REST Web Services features              | Enabled under Setup > Company > Enable Features > SuiteCloud | Authentication                                                                  |
| Role permission: Log in using OAuth 2.0 Access Tokens | Allow                                                        | Authentication                                                                  |
| Role permission: REST Web Services                    | Allow                                                        | SuiteQL queries                                                                 |
| View access to employees                              | View                                                         | Users                                                                           |
| Read access to employee role assignments              | View                                                         | AdminStatus. Without it, users are still collected and AdminStatus stays empty. |

## Create credentials in Oracle NetSuite

{% stepper %}
{% step %}

### Enable the features

Under **Setup > Company > Enable Features > SuiteCloud**, enable **OAuth 2.0** and **REST Web Services**.
{% endstep %}

{% step %}

### Create the integration record

Go to **Setup > Integration > Manage Integrations > New**. Check **Client Credentials (Machine to Machine) Grant** and the **REST Web Services** scope, save, and copy the client ID. It is shown only once.
{% endstep %}

{% step %}

### Create a key pair

NetSuite accepts RSA keys of 3072 or 4096 bits and EC keys of 256, 384 or 521 bits. For an RSA-PSS certificate:

```
openssl req -new -x509 -newkey rsa:4096 -keyout private.pem -sigopt rsa_padding_mode:pss -sha256 -sigopt rsa_pss_saltlen:64 -out public.pem -nodes -days 365
```

{% endstep %}

{% step %}

### Map the certificate

Go to **Setup > Integration > Manage Authentication**, open **OAuth 2.0 Client Credentials (M2M) Setup** and click **Create New**. Choose the entity, the role and the integration record, and upload `public.pem`. Copy the **Certificate ID** NetSuite shows.
{% endstep %}

{% step %}

### Give the role its permissions

The role in the mapping needs **Log in using OAuth 2.0 Access Tokens** and **REST Web Services**, and view access to employees.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter            | Required | Type    | Default | Description                                                                                                                                             |
| -------------------- | -------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Domain               | Yes      | String  |         | Account REST host without `https://`. Find it under **Setup > Company > Company Information > Company URLs** as SuiteTalk (SOAP and REST Web Services). |
| Client ID            | Yes      | String  |         | Client ID of the integration record.                                                                                                                    |
| Certificate ID       | Yes      | String  |         | Certificate ID of the M2M mapping (sent as the JWT `kid`).                                                                                              |
| Private Key          | Yes      | String  |         | Private key of the uploaded certificate, PEM.                                                                                                           |
| Signing Algorithm    | No       | Choice  | PS256   | PS256, PS384, PS512 for RSA keys. ES256, ES384, ES512 for EC keys.                                                                                      |
| Fetch All Attributes | No       | Boolean | False   | Collect every employee field the role can read, not just the fields the adapter uses.                                                                   |
| Page Size            | No       | Integer | 1000    | Records per query page. 1 to 1000.                                                                                                                      |
| Max Results          | No       | Integer | 100000  | Highest number of records collected per query. NetSuite returns at most 100,000 for a SuiteQL query.                                                    |
| Proxy                | No       | String  |         | Proxy address as `host:port`.                                                                                                                           |
| Timeout              | No       | Integer | 30      | Seconds to wait for API responses.                                                                                                                      |

## Troubleshooting

| Error message                                              | Cause                                           | Fix                                                                 |
| ---------------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------- |
| NetSuite token response has no access\_token.              | The token call returned no token.               | Check Client ID, Certificate ID, private key and signing algorithm. |
| NetSuite concurrency limit reached, retrying in seconds.   | NetSuite answered 429.                          | No action. The adapter retries.                                     |
| Employee roles could not be read, AdminStatus stays empty. | The role cannot read employee role assignments. | Give the role view access to employee roles.                        |

## Change history

{% hint style="info" %}
Available starting from version 6.9.0.
{% endhint %}
