---
title: Authorization API - Notehub API Reference
description: The Notehub authorization API contains an endpoint to generate an OAuth bearer token.
source_url: https://dev.blues.io/api-reference/notehub-api/authorization-api/
canonical_url: https://dev.blues.io/api-reference/notehub-api/authorization-api/
markdown_url: https://dev.blues.io/api-reference/notehub-api/authorization-api.md
---

# Authorization API

The Notehub authorization API contains endpoints to generate authentication tokens for use with other Notehub API requests.

> **Warning:**
>
> OAuth Bearer Tokens are no longer the recommended way to authenticate with the Notehub API. New integrations should use [Personal Access Tokens](https://dev.blues.io/api-reference/notehub-api.md#authentication-with-personal-access-tokens) instead, which offer simpler setup, configurable expiration, and the ability to suspend or revoke individual tokens without affecting other integrations.

| Name                                          | HTTP Request             |
| --------------------------------------------- | ------------------------ |
| [Generate OAuth Token](#generate-oauth-token) | **POST** `/oauth2/token` |

## Generate OAuth Token (Notehub)

Generate an OAuth bearer token that can be used to authenticate subsequent Notehub API requests.

|              |                                         |
| ------------ | --------------------------------------- |
| HTTP Method: | `POST`                                  |
| URL:         | `https://api.notefile.net/oauth2/token` |

Arguments

### `grant_type`

*string*

This argument must be set to `"client_credentials"`.

### `client_id`

*string*

The client ID of an OAuth Client registered on the Notehub project. See [here](https://dev.blues.io/api-reference/notehub-api.md#authentication-with-oauth-bearer-tokens) for details.

### `client_secret`

*string*

The client secret of an OAuth Client registered on the Notehub project. See [here](https://dev.blues.io/api-reference/notehub-api.md#authentication-with-oauth-bearer-tokens) for details.

**Example**

**Bash**

```bash
curl -X POST
 -L 'https://api.notefile.net/oauth2/token'
 -H 'content-type: application/x-www-form-urlencoded'
 -d grant_type=client_credentials
 -d client_id=your-client-id
 -d client_secret=your-client-secret
```

**Response Members**

### `access_token`

*string*

The string OAuth bearer token. This is the value you’ll want to save for use in subsequent Notehub API requests.

### `expires_in`

*integer*

The number of seconds until the access token expires.

### `token_type`

*string*

The type of token returned. Currently this will always be set to `"bearer"`.

Example Response

```json
{
  "access_token": "abc123...",
  "expires_in": 1799,
  "token_type": "bearer"
}
```

[Notehub API Introduction](https://dev.blues.io/api-reference/notehub-api.md "Notehub API Introduction") [Billing Account API](https://dev.blues.io/api-reference/notehub-api/billing-account-api.md "Billing Account API")
