> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Credentials

> Step-by-step instructions for obtaining HubSpot API keys, OAuth credentials, and webhook secrets.

This guide walks you through obtaining all required credentials for the HubSpot plugin.

## Authentication Methods

The HubSpot plugin supports both API key and OAuth 2.0 authentication methods.

* **[`api_key`](/concepts/api-key)** - Private App API key authentication
* **[`oauth_2`](/concepts/oauth)** - OAuth 2.0 authentication

## API Key Authentication (Private App)

### Step 1: Create Private App

1. Go to HubSpot Settings
2. Navigate to **Integrations** → **Private Apps**
3. Click **Create a private app**
4. Enter an app name
5. Click **Create app**

### Step 2: Configure Scopes

1. In your private app settings, go to **Scopes** tab
2. Select the required scopes:
   * `crm.objects.contacts.read`
   * `crm.objects.contacts.write`
   * `crm.objects.companies.read`
   * `crm.objects.companies.write`
   * `crm.objects.deals.read`
   * `crm.objects.deals.write`
   * `crm.objects.tickets.read`
   * `crm.objects.tickets.write`
   * `engagements.read`
   * `engagements.write`
   * Add any other scopes your application needs
3. Click **Save**

### Step 3: Get API Key

1. Go to the **Overview** tab
2. Under **API key**, click **Show** to reveal the key
3. Copy the API key
4. Store it securely

**Storing Credentials:**

Store the API key with the Corsair CLI:

```bash theme={null}
pnpm corsair setup --plugin=hubspot api_key=your-api-key
```

Verify it was saved:

```bash theme={null}
pnpm corsair auth --plugin=hubspot --credentials
```

## OAuth 2.0 Authentication

### Step 1: Create App

1. Go to [HubSpot Developer Portal](https://developers.hubspot.com/)
2. Click **Create app**
3. Enter your app name and click **Create app**

### Step 2: Configure OAuth Settings

1. In your app settings, go to **Auth** tab
2. Under **Redirect URLs**, click **Add**
3. Add your OAuth redirect URL (e.g., `https://yourapp.com/auth/hubspot/callback`)
4. Click **Save**

### Step 3: Get Client Credentials

1. In the **Auth** tab, you'll see your **Client ID**
2. Click **Show** next to **Client Secret** to reveal it
3. Copy the **Client ID** and **Client Secret**
4. Store these securely

**Storing Credentials:**

Store your OAuth app credentials, then start the flow:

```bash theme={null}
pnpm corsair setup --plugin=hubspot client_id=your-client-id client_secret=your-client-secret
pnpm corsair auth --plugin=hubspot
```

The CLI will print an authorization URL — open it in a browser. Once you approve, tokens are saved automatically.

## Webhook Secret

### Step 1: Create Webhook Subscription

1. Go to [HubSpot Settings](https://app.hubspot.com/settings)
2. Navigate to **Integrations** → **Private Apps**
3. Select your private app (or create one if needed)
4. Go to **Webhooks** tab
5. Click **Create subscription**
6. Configure:
   * **Event type**: Select from:
     * Contact created/updated/deleted
     * Company created/updated/deleted
     * Deal created/updated/deleted
     * Ticket created/updated/deleted
   * **Webhook URL**: Your webhook endpoint (e.g., `https://yourapp.com/api/webhook`)
7. Click **Save**
8. If a webhook secret is provided, copy it and store securely

**Storing Credentials:**

Store the webhook secret with the CLI:

```bash theme={null}
pnpm corsair setup --plugin=hubspot webhook_signature=your-webhook-secret
```

## Required Credentials Summary

| Credential     | Required For | Where to Find                                     |
| -------------- | ------------ | ------------------------------------------------- |
| API Key        | API Key auth | Settings → Integrations → Private Apps → Overview |
| Client ID      | OAuth 2.0    | Developer Portal → App Settings → Auth            |
| Client Secret  | OAuth 2.0    | Developer Portal → App Settings → Auth            |
| Webhook Secret | Webhooks     | Settings → Integrations → Private Apps → Webhooks |

For general information about how Corsair handles authentication, see [Authentication](/concepts/auth).
