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

# API Resources

> Add API Resources to your project to build reusable Triggers and Steps for your API in Workflows.

## Overview

API Resources are reusable connections to your internal API endpoints that can be used to define Requests and Triggers for Workflows.

With API Resources, you can:

* Connect Workflows to existing webhooks in your API
* Define your API configuration once (including authentication and basic API details) and reuse it across requests made in Workflows

## Getting Started

To start creating an API Resource, navigate to the **Resources** page in your dashboard sidebar and click **Create Resource**.

You will be prompted to name your Resource, which will be used to reference your API in Triggers and Requests. For example, if your Resource is named "TaskLab", you will see "TaskLab Request" Steps and "TaskLab Triggers" appear as options for your Workflows.

<Frame>
  <img src="https://mintcdn.com/paragon/HSp5hB8tE4Z6e44m/assets/Setting%20up%20API%20Resources%20in%20Paragon%20Connect.png?fit=max&auto=format&n=HSp5hB8tE4Z6e44m&q=85&s=a79b7aa595b2961421fa92abbefa003b" alt="Setting up an API Resource in Paragon Connect" width="2016" height="1114" data-path="assets/Setting up API Resources in Paragon Connect.png" />
</Frame>

### API Info

Next, you'll configure your API Resource with details on how your API authenticates and sends requests.

1. **Choose between a User-Level and an App-Level Resource.** **User-Level Resources** require you to use the SDK/API to save separate API credentials for each of your Connected Users. Choose this option if each of your users will have separate OAuth tokens or API keys. **App-Level Resources** use one set of API credentials to authenticate for all of your Connected Users. Choose this option if one set of API keys/service account credentials will be used to authenticate to your API from Paragon.

2. **Select an authentication type.** Resources support the most common API authentication types, including OAuth 2.0 (Refresh Token or Client Credentials) and API Keys.

<Frame>
  <img src="https://mintcdn.com/paragon/DkcdqxlytLXlO_-w/assets/Choosing%20Authorization%20Methods%20for%20API%20Resources%20in%20Paragon%20Connect.png?fit=max&auto=format&n=DkcdqxlytLXlO_-w&q=85&s=03626a8d50572afa2656648b3103993c" alt="Choosing Authorization Methods for API Resources in Paragon Connect" width="1670" height="1626" data-path="assets/Choosing Authorization Methods for API Resources in Paragon Connect.png" />
</Frame>

### Authorization

**Note**: The next steps may vary depending on which options you select above. If you selected App-Level Resource, proceed directly to [Request Details](/workflows/api-resources#request-details).

#### OAuth 2.0

If you selected OAuth 2.0 authentication, you'll need to provide the following details:

* **Access Token URL**: URL that Paragon will use to refresh OAuth tokens for your API.
* **Client ID and Client Secret**: The `client_id` and `client_secret` parameters that will be used for the OAuth refresh request to the preconfigured URL.
* Optionally, you can configure additional settings under Advanced Options:

  * **Required Inputs**: Add an input to this list if you need to parameterize values like the Access Token URL or API Base URL.

  * **Include Client ID and Secret**: You can disable this setting if your integration does not use a Basic Authorization header to pass your Client ID and Secret into the token request.

<Frame>
  <img src="https://mintcdn.com/paragon/XNDe-bFT_2yOxy1A/assets/Configuring%20OAuth%202.0%20for%20API%20Resources%20in%20Paragon%20Connect.png?fit=max&auto=format&n=XNDe-bFT_2yOxy1A&q=85&s=2e902b82306fbd130c923f8d30ffe324" alt="Configuring OAuth 2.0 for API Resources in Paragon Connect" width="1860" height="1320" data-path="assets/Configuring OAuth 2.0 for API Resources in Paragon Connect.png" />
</Frame>

#### API Keys

If you selected API Key authentication, you'll need to provide the names of any values that are required as a part of a user's credentials to your API.

For example, if your API requires a username and password to authenticate, add `username` and `password` as API Key names.

<Frame>
  <img src="https://mintcdn.com/paragon/XNDe-bFT_2yOxy1A/assets/Configuring%20API%20Keys%20for%20API%20Resources%20in%20Paragon%20Connect.png?fit=max&auto=format&n=XNDe-bFT_2yOxy1A&q=85&s=889810618726459d36d280f622e78daf" alt="Configuring API Keys for API Resources in Paragon Connect" width="1862" height="1130" data-path="assets/Configuring API Keys for API Resources in Paragon Connect.png" />
</Frame>

### Request Details

Next, define a template for how requests are sent to your API.

* **API Base URL**: URL that should be used to send requests.

  * If you are using a User-Level Resource and added Required Inputs in the **Authorization** step, you can use the variable menu (type `{{` to open) to parameterize this value with a user-specific input.

* **API Authentication:** Define how tokens or other values are used to authenticate requests sent to your API.

* Optionally, if you are using a User-Level Resource, you can configure a User Profile.

  * User Profiles are retrieved from your API at the time of first authentication and can be used to store persistent information about the user's Resource Connection.

  * You can configure a Request or use a field from a JWT-encoded access token to save the User Profile.

<Frame>
  <img src="https://mintcdn.com/paragon/XNDe-bFT_2yOxy1A/assets/Configuring%20Request%20Details%20for%20API%20Resources%20in%20Paragon%20Connect.png?fit=max&auto=format&n=XNDe-bFT_2yOxy1A&q=85&s=5a199e15fa9970b653563b05e3fb6223" alt="Configuring Request Details for API Resources in Paragon Connect" width="1842" height="1188" data-path="assets/Configuring Request Details for API Resources in Paragon Connect.png" />
</Frame>

### Test and Publish

Finally, you can send a test request to your API Resource to verify that you can connect to your API.

If you are using a User-Level Resource, you will be prompted to enter test credentials using your Required Fields (and an access/refresh token, for OAuth). *This step must be completed to test your Resource in the Workflow Editor and Webhook Setup pages.*

<Frame>
  <img src="https://mintcdn.com/paragon/HSp5hB8tE4Z6e44m/assets/Testing%20and%20Finishing%20API%20Resources%20in%20Paragon%20Connect.png?fit=max&auto=format&n=HSp5hB8tE4Z6e44m&q=85&s=fde45573dd58fb3181967f520af0da21" alt="Testing and Finishing API Resources in Paragon Connect" width="1842" height="1696" data-path="assets/Testing and Finishing API Resources in Paragon Connect.png" />
</Frame>

Once you are finished verifying that your API Resource can send requests successfully, click **Finish** to save your Resource configuration.

## Connecting Resources

If you are using User-Level Resources, you will need to connect your users' credentials to ensure that Resource Requests and Triggers can run as expected.

<Tabs>
  <Tab title="JavaScript SDK">
    To connect your users' credentials via your frontend application, you can use the SDK's `connectAction` method to pass through the Required Keys for your User-Level Resource.

    **Example OAuth 2.0 connectAction call:**

    ```js theme={null}
    await paragon.connectAction("Resource Name", {
        access_token: "eyJ....",
        refresh_token: "ref_123..."
    });
    ```

    <Tip>
      You can visit **Resource Setup** > **Test and Publish** to see a code example of your specific Resource, with all required keys.
    </Tip>
  </Tab>

  <Tab title="REST API">
    To connect your users' credentials via the REST API, perform the following request:

    ```http theme={null}
    POST https://zeus.useparagon.com/projects/[Project ID]/sdk/resources/[Resource ID]/connect
    Authorization: Bearer [Paragon User Token]
    Content-Type: application/json

    { 
      "access_token": "eyJ...",
      "refresh_token": "ref_123..." 
    }
    ```

    * **Project ID**: Your Paragon Project ID

    * **Resource ID**: You can find your Resource ID in your dashboard, in the URL of your Resource page. It is a UUID which follows the `/resources/` path of the URL.

          <Frame>
            <img src="https://mintcdn.com/paragon/fpLCYjVDKL_JwtxK/assets/finding-your-api-resource-id-in-the-paragon-dashboard.png?fit=max&auto=format&n=fpLCYjVDKL_JwtxK&q=85&s=59cf3682fdd6110eb5c6e486314da56a" alt="" width="2848" height="736" data-path="assets/finding-your-api-resource-id-in-the-paragon-dashboard.png" />
          </Frame>

    * **Paragon User Token:** The User Token which authenticates the Connected User you are trying to connect a Resource for.
  </Tab>
</Tabs>
