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

# API Setup

> Connect Nectir AI to Canvas using the API integration to sync course materials and assignments

## Overview

The Canvas API integration connects your Nectir AI Workspace to Canvas, enabling you to import course materials like pages, assignments, files, discussion topics, and quizzes directly into your AI Assistants' knowledge base.

<Note>
  This guide covers the **API integration** method. If you're looking to embed Nectir AI directly inside Canvas courses via LTI, see the [Canvas LTI Guided Setup](/lms-integrations/canvas-lti-guided) instead.
</Note>

### Prerequisites

* **Canvas Admin access** at the account level (to create Developer Keys)
* **Nectir AI Workspace Owner** role

### Before You Begin

You'll set this up by switching between two browser tabs, so open both before you start:

* **Nectir AI** with the Workspace you want to integrate
* **Canvas** with admin access at the account level

You'll begin in Nectir AI to open the credential form, then switch to Canvas to create the API key. The order matters here. Canvas shows the **Client Secret** only once, right when you save the key. With the Nectir AI form already open, you can copy the secret straight across before it disappears.

<Warning>
  Canvas reveals the Client Secret a single time, right after you save the API key. Copy it into Nectir AI immediately. If you lose it, you'll need to [rotate the key's credentials](/lms-integrations/canvas-lti-rotate-credentials) to generate a new secret.
</Warning>

## Part 1: Start the API Integration in Nectir AI

<Steps>
  <Step title="Open LMS Integration Settings">
    In Nectir AI, click the **gear icon** next to your Workspace name, then select **LMS integration** in the settings sidebar.
  </Step>

  <Step title="Add Canvas Integration">
    Click **+ Add integration**, then click **Connect** under Canvas.
  </Step>

  <Step title="Choose API Integration">
    Select **API integration**. This opens the credential form with three fields: **Canvas instance URL**, **API key Client ID**, and **API key Client Secret**.

    <Frame caption="Choose API integration to connect via API key">
      <img src="https://mintcdn.com/nectir/aBz7s9a4np5oKqxD/images/canvas-api-choose-api.png?fit=max&auto=format&n=aBz7s9a4np5oKqxD&q=85&s=72f84b501326b9f40b7fdb18fc65b406" alt="Connect Canvas modal showing LTI integration and API integration options" width="2130" height="962" data-path="images/canvas-api-choose-api.png" />
    </Frame>

    Leave this tab open on the credential form, then switch to your Canvas tab to create the API key.
  </Step>
</Steps>

## Part 2: Create an API Key in Canvas

<Steps>
  <Step title="Navigate to Developer Keys">
    In Canvas, click **Admin** in the left sidebar, select your account, then click **Developer Keys** in the account navigation.
  </Step>

  <Step title="Create a New API Key">
    Click the **+ Developer Key** button in the top right, then select **+ API Key** from the dropdown.
  </Step>

  <Step title="Configure Key Settings">
    In the **Key Settings** form, fill in the following:

    * **Key Name**: Enter a descriptive name (e.g., `Nectir AI API Key`)
    * **Redirect URIs**: Enter the following URI exactly:

    ```
    https://ai.nectir.io/api/canvas/oauth/callback
    ```

    All other fields (Owner Email, Icon URL, Notes, etc.) can be left blank.
  </Step>

  <Step title="Configure API Scopes">
    Keep the **Enforce Scopes** toggle turned **ON** (it's on by default).

    Check the **Allow Include Parameters** checkbox. This lets Nectir AI surface additional course details (such as sub-account and instructor) in the course selector, making it easier to identify the right course when adding materials.

    Check the **Read only** checkbox at the top of the scopes list. This grants read-only access to Canvas data, which is all Nectir AI needs.

    <Tip>
      The **Read only** option is the quickest way to configure scopes. Nectir AI only reads course data. It never modifies or deletes anything in Canvas.
    </Tip>

    <Frame caption="Check the Read only checkbox to grant read-only API access">
      <img src="https://mintcdn.com/nectir/D_GLNkbi2Kgsfv4U/images/canvas-api-read-only-scopes.png?fit=max&auto=format&n=D_GLNkbi2Kgsfv4U&q=85&s=d34a34eed1761a14b7d99ec33bf9b8c6" alt="Canvas Key Settings showing Enforce Scopes enabled, and Allow Include Parameters and Read only checkboxes checked" width="3456" height="1928" data-path="images/canvas-api-read-only-scopes.png" />
    </Frame>

    <Accordion title="Advanced: Select Only the Required Scopes">
      If your institution's security policy requires least-privilege access, you can select only the specific scopes Nectir AI needs instead of checking **Read only**. Enable each of the following scopes:

      | Canvas Category                 | Scope                                                        | What Nectir Uses It For                            |
      | ------------------------------- | ------------------------------------------------------------ | -------------------------------------------------- |
      | **Courses**                     | `GET /api/v1/courses`                                        | List the user's courses for the course selector    |
      | **Courses - Modules**           | `GET /api/v1/courses/:course_id/modules`                     | Fetch course module structure for import           |
      | **Courses - Modules**           | `GET /api/v1/courses/:course_id/modules/:module_id/items`    | Fetch items within a module for import             |
      | **Courses - Files**             | `GET /api/v1/courses/:course_id/files`                       | List course files for import                       |
      | **Courses - Pages**             | `GET /api/v1/courses/:course_id/pages`                       | List wiki pages for import                         |
      | **Courses - Pages**             | `GET /api/v1/courses/:course_id/pages/:url_or_id`            | Fetch a page's full content for import             |
      | **Courses - Assignments**       | `GET /api/v1/courses/:course_id/assignments`                 | List assignments for import                        |
      | **Courses - Assignments**       | `GET /api/v1/courses/:course_id/assignments/:id`             | Fetch an assignment's full content for import      |
      | **Courses - Discussion Topics** | `GET /api/v1/courses/:course_id/discussion_topics`           | List discussion topics for import                  |
      | **Courses - Discussion Topics** | `GET /api/v1/courses/:course_id/discussion_topics/:topic_id` | Fetch a discussion topic's full content for import |
      | **Courses - Quizzes**           | `GET /api/v1/courses/:course_id/quizzes`                     | List quizzes for import                            |
      | **Courses - Quizzes**           | `GET /api/v1/courses/:course_id/quizzes/:id`                 | Fetch a quiz's details for import                  |
      | **Courses - Quizzes**           | `GET /api/v1/courses/:course_id/quizzes/:quiz_id/questions`  | Fetch quiz questions for import                    |
      | **Files**                       | `GET /api/v1/files/:id`                                      | Fetch file metadata and download URL for import    |
      | **Files**                       | `GET /api/v1/files/:id/public_url`                           | Refresh expiring download URLs for ongoing sync    |

      <Note>
        All scopes are read-only (GET), and all operate at the course level. Nectir AI requests no account- or admin-level scopes, so the key only ever reaches courses the authorizing account is enrolled in. Nectir AI never creates, modifies, or deletes any data in Canvas.
      </Note>
    </Accordion>
  </Step>

  <Step title="Save the Key">
    Click **Save** at the bottom right of the Key Settings form. Canvas creates the key and reveals the **Client Secret** one time only.
  </Step>

  <Step title="Copy the Client Secret into Nectir AI">
    Copy the **Client Secret** that Canvas displays after saving, switch to your Nectir AI tab, and paste it into the **API key Client Secret** field right away.

    <Frame caption="Copy the Client Secret as soon as it appears">
      <img src="https://mintcdn.com/nectir/AddMKLZL8rHTGuIN/images/canvas-api-client-secret.png?fit=max&auto=format&n=AddMKLZL8rHTGuIN&q=85&s=6a56740fbabf0097d9e9ac2ad671aff6" alt="Canvas Developer Key Created dialog warning that the secret is shown only once, with the API Key secret value displayed" width="1814" height="826" data-path="images/canvas-api-client-secret.png" />
    </Frame>

    <Warning>
      Don't close the **Developer Key Created** dialog before copying the secret. Canvas shows the full secret only once, and the only way to recover from a lost secret is to [rotate the credentials](/lms-integrations/canvas-lti-rotate-credentials).
    </Warning>
  </Step>

  <Step title="Copy the Client ID into Nectir AI">
    Back in Canvas, find the **Client ID**, the number shown under the **Details** column in the Developer Keys listing. Copy it, switch to your Nectir AI tab, and paste it into the **API key Client ID** field.

    <Frame caption="The Client ID is the number under the Details column">
      <img src="https://mintcdn.com/nectir/AddMKLZL8rHTGuIN/images/canvas-api-client-id.png?fit=max&auto=format&n=AddMKLZL8rHTGuIN&q=85&s=5aed2eb3a3f4092971f59088a65f12e9" alt="Canvas Developer Keys table with the Client ID number highlighted under the Details column" width="2686" height="422" data-path="images/canvas-api-client-id.png" />
    </Frame>
  </Step>

  <Step title="Enable the Key">
    Back on the Developer Keys listing, find your new key and click the toggle in the **State** column to turn it **ON** (green). The key must be enabled for the connection to succeed.
  </Step>
</Steps>

## Part 3: Complete the Connection in Nectir AI

<Steps>
  <Step title="Enter Your Canvas URL">
    Switch back to your Nectir AI tab, where the Client ID and Client Secret are already filled in. In the **Canvas instance URL** field, enter your Canvas URL (e.g., `https://yourschool.instructure.com`).

    <Frame caption="Enter your Canvas URL, Client ID, and Client Secret">
      <img src="https://mintcdn.com/nectir/aBz7s9a4np5oKqxD/images/canvas-api-enter-credentials.png?fit=max&auto=format&n=aBz7s9a4np5oKqxD&q=85&s=82eb1dfec7ebee3eb0d52b49a4f51973" alt="Nectir AI Connect Canvas API form with Canvas instance URL, API key Client ID, and API key Client Secret fields" width="2172" height="1600" data-path="images/canvas-api-enter-credentials.png" />
    </Frame>
  </Step>

  <Step title="Save and Test Connection">
    Click **Save and test connection**. Nectir AI redirects you to a Canvas OAuth authorization screen.

    <Frame caption="Canvas OAuth authorization screen">
      <img src="https://mintcdn.com/nectir/aBz7s9a4np5oKqxD/images/canvas-api-oauth-authorize.png?fit=max&auto=format&n=aBz7s9a4np5oKqxD&q=85&s=ba51c5cf376bf5371ce849299b1fc87b" alt="Canvas OAuth screen prompting the user to authorize Nectir AI access" width="1730" height="898" data-path="images/canvas-api-oauth-authorize.png" />
    </Frame>

    Click **Authorize** to grant Nectir AI read-only access to your Canvas data. Canvas returns you to Nectir AI automatically.

    <Frame caption="A successful connection confirms your API setup is complete">
      <img src="https://mintcdn.com/nectir/aBz7s9a4np5oKqxD/images/canvas-api-connection-success.png?fit=max&auto=format&n=aBz7s9a4np5oKqxD&q=85&s=59f2fc5b39f410afc78f79ac3039a4a2" alt="Nectir AI showing a successful Canvas API connection confirmation" width="2296" height="582" data-path="images/canvas-api-connection-success.png" />
    </Frame>

    <Check>
      Your Canvas API integration is now active. Users can now import their Canvas course into their Assistant's knowledge base automatically.
    </Check>
  </Step>
</Steps>

## Verify the Integration

The API integration is working when instructors can browse Canvas course content from an Assistant. The quickest way to confirm this is to open an Assistant's **Knowledge** tab and check that the **Add from Canvas** option appears.

Most institutions that set up the API integration also run the Nectir AI LTI integration, so you can verify in the course context your instructors actually use.

<Steps>
  <Step title="Open an Assistant in a Canvas Course">
    Launch Nectir AI from a Canvas course that already has the [Nectir AI LTI integration](/lms-integrations/canvas-lti-guided) enabled. If you don't have one handy, use a test course: go to the course's **Settings** > **Navigation** tab, enable **Nectir AI**, save, then click **Nectir AI** in the course navigation to create or link a Group. See [Canvas Workspace Setup](/getting-started/workspace-setup-canvas) for the full linking flow.

    <Note>
      You can also open an Assistant directly in Nectir AI without launching from Canvas. The LTI launch simply mirrors the instructor's real workflow.
    </Note>
  </Step>

  <Step title="Open the Knowledge Tab">
    Hover over your Assistant, click the **three dots**, select **Settings**, then navigate to the **Knowledge** tab.
  </Step>

  <Step title="Confirm Add from Canvas Is Available">
    Click **+ Add knowledge** and confirm that **Add from Canvas** appears as an option.

    <Frame caption="The Add knowledge menu lists Add from Canvas when the API integration is active">
      <img src="https://mintcdn.com/nectir/AddMKLZL8rHTGuIN/images/canvas-api-add-from-canvas.png?fit=max&auto=format&n=AddMKLZL8rHTGuIN&q=85&s=cc744fedd66c26a05d84dfbf0d746ddc" alt="Nectir AI Add knowledge dialog showing Upload, Import course export, Add website, and Add from Canvas options" width="2794" height="1420" data-path="images/canvas-api-add-from-canvas.png" />
    </Frame>

    <Check>
      If **Add from Canvas** is listed, your API integration is live. See [Add from Canvas](/creating/canvas-import) for the full import workflow.
    </Check>

    If the option is missing, see the troubleshooting note below.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection test fails" icon="circle-xmark">
    * Verify your Canvas URL is correct and includes `https://` (e.g., `https://yourschool.instructure.com`)
    * Confirm the Client ID and Client Secret are copied exactly with no extra spaces
    * Check that the API key is enabled (green toggle) in Canvas Developer Keys
  </Accordion>

  <Accordion title="'Add from Canvas' is not available" icon="eye-slash">
    * Confirm Part 3 finished successfully and the connection shows as active in **Workspace settings** > **LMS integration**
    * Make sure the API key is enabled (green toggle) in Canvas
    * The Assistant must belong to the Workspace where the API integration was configured
  </Accordion>

  <Accordion title="Invalid redirect URI error" icon="link-slash">
    Ensure the Redirect URI in your Canvas API key is exactly:

    ```
    https://ai.nectir.io/api/canvas/oauth/callback
    ```

    Check for trailing spaces, missing characters, or incorrect protocol (`http` vs `https`).
  </Accordion>

  <Accordion title="Permission errors when importing content" icon="lock">
    Verify that all required scopes are enabled on your API key in Canvas. Either the **Read only** checkbox should be checked, or the individual scopes listed in [Configure API Scopes](#configure-api-scopes) should be enabled.
  </Accordion>

  <Accordion title="Lost the Client Secret" icon="key">
    The Client Secret is shown only once, when you save the key. If you didn't copy it in time, follow the [credential rotation guide](/lms-integrations/canvas-lti-rotate-credentials) to generate a new secret, then re-enter it in Nectir AI.
  </Accordion>

  <Accordion title="Can't find Developer Keys in Canvas" icon="eye-slash">
    The Developer Keys page is only available to Canvas administrators at the account level. If you don't see it in the Admin sidebar, contact your institution's Canvas administrator to request access or have them create the key for you.
  </Accordion>
</AccordionGroup>

For additional help, contact [support@nectir.io](mailto:support@nectir.io).

## Next Steps

<CardGroup cols={2}>
  <Card title="Add from Canvas" icon="download" href="/creating/canvas-import">
    Learn how to browse and import Canvas course content into your Assistant's knowledge base
  </Card>

  <Card title="Canvas LTI Setup" icon="plug" href="/lms-integrations/canvas-lti-guided">
    Set up the LTI integration to embed Nectir AI directly inside Canvas courses
  </Card>
</CardGroup>
