# Authentication

All requests to the NSE API must be authenticated. NSE supports two authentication methods for API access:

1. **Service Account** — a machine identity, scoped to an organization, authenticated via OAuth 2.0 Client Credentials and used with a JWT Bearer token. Intended for backend/server-to-server integrations that are not tied to a specific human user.
2. **Personal Access Token (PAT)** — a token tied to an individual user, sent via a dedicated header. Intended for scripts, quick integrations, or automation performed on behalf of that user.


There is no token type that grants unrestricted, organization-wide access to all envelopes, templates, and files. Every request — whether authenticated via a Service Account or a PAT — is scoped to the permissions of the identity behind the token (the service account or the owning user, respectively).

## Method 1: Service Account (JWT via Client Credentials)

A Service Account is an identity created and managed within an organization, used to authenticate backend integrations without a user login.

### Creating a Service Account

1. Go to **Organization Settings** → **Users** → **Service Accounts**.
2. Click **Create Service Account** and provide a **Client ID** (must be unique).
3. On save, NSE provisions the account and returns a **Client Secret**. Save it immediately — like a password, it is not retrievable again after you leave the page.


Service accounts are scoped to the organization they were created in, and can be viewed, managed, and deleted from the same **Service Accounts** page.

### Obtaining a token

Use the Client Credentials grant to obtain a JWT Bearer token.

## Method 2: Personal Access Token (PAT)

A Personal Access Token authenticates API requests **as the individual user who created it** — it inherits that user's full set of permissions (no separate scopes).

### Creating a PAT

1. Go to **Settings** → **User Account** → **Personal Access Tokens**.
2. Click **New Personal Access Token**, provide a **Name** and an **Expiration date** (both required).
3. Click **Save**. The full token value is shown **only once**, in the format `nse_pat_<40-character string>`. Copy it immediately — it cannot be retrieved again after leaving the page.


The list view later shows only name, creation date, and expiration date — never the token value itself. Tokens can be deleted at any time from the same page.

### Using a PAT

Send the PAT in a dedicated header — not `Authorization`:

```
Personal-Access-Token: nse_pat_<value>
```