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

# Embedding workspace

> A quick overview of how to embed Dock's workspace in your app.

## How to embed a Dock workspace into your app

You’re a developer who has a SaaS application and you want to embed Dock within your application.
The following guide will explain how to set up an onboarding experience for your customers.

Your “onboarding experience“ is an onboarding Dock workspace that’s associated with an account that has signed up for your app.
Once you create the workspace template, you can now create workspaces for new accounts that sign up for your app.

Account represents any external relationships, typically another company. The most common use case for an Account is your customer or sales prospect.
Integration with external systems like Salesforce and HubSpot allows for seamless synchronization of account data, enhancing the management of client relationships and related business processes.
All the accounts are associated with a company that can be accessed via the [API](/api-reference/endpoint/accounts/retrieve-a-list-of-accounts).
An account can also be [created](/api-reference/endpoint/accounts/create-an-account), [updated](/api-reference/endpoint/accounts/update-an-account) via the API.

Example:

* OpenAI has signed up for your app.
* After they signup you can create an onboarding workspace for them.
* If you’re using Salesforce and OpenAI is associated with an account:
  * [Documentation](/api-reference/endpoint/workspaces/create-a-workspace) to create workspace with Salesforce account Id
* If you’re using HubSpot and OpenAI is associated with a company:
  * [Documentation](/api-reference/endpoint/workspaces/create-a-workspace) to create workspace with HubSpot company Id
* If you are using neither CRM you can manually create an Dock account:
  * [Documentation](/api-reference/endpoint/accounts/create-an-account) to create Dock account
  * [Documentation](/api-reference/endpoint/workspaces/create-a-workspace) to create workspace with Dock account
* In your application, you have a page where you want to embed the Dock workspace.
* There’s a user signed in to your app ([sam@openai.com](mailto:sam@openai.com)). They are associated with the account, OpenAI.
* You want to create an Authenticated Embed Url, for [sam@openai.com](mailto:sam@openai.com), for the workspace you created for the account, OpenAI. [documentation](/api-reference/endpoint/workspaces/create-a-workspace)
* This generated url will automatically log in [sam@openai.com](mailto:sam@openai.com) to the Dock workspace.

<Info>
  In order to embed a workspace in your app you must have access to the Dock API
  and the workspace that you want to embed must be published
</Info>

## To embed a workspace in your app, you'll need to follow these steps:

<Steps>
  <Step title="Use the API to get the authenticated embed url for a user">
    Implement a business logic in your app that hits the [authenticated embed
    url api end
    point](api-reference/endpoint/workspaces/get-an-authenticated-embed-url)
    with the **email** of the user that you want to log in and the **workspace
    id**
  </Step>

  <Step title="Embed the url received in the response in an iframe">
    Use the url received in the response and embed it in an iframe in your app.

    ```iframe theme={null}
    <iframe src="https://opeanai.dock.us/embed/acme-JxFWgdSeWad9?authToken=24193e14b10a3e8f359bb634ca8228b3fd196ad0d88350918106c2442cffd023"></iframe>
    ```

    <Note>
      Once an authenticated embed url is generated it remains valid for 2 minutes. So, make sure to use it within 2 minutes.
    </Note>
  </Step>

  <Step title="Token verification and workspace access">
    Once the iframe is loaded the **authToken** in the url is exchanged with the
    server in order to authenticate the user. Once verified the user can access
    and interact with the workspace.
  </Step>
</Steps>
