> For the complete documentation index, see [llms.txt](https://docs-v3.toucantoco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v3.toucantoco.com/visualizations-and-layouts/embedding/embed-sdk/embed-sdk-authentication.md).

# Embed SDK Authentication

Some methods are calling directly Toucan's API, such as:

* [sendPDFReport](/visualizations-and-layouts/embedding/embed-sdk.md#sendpdfreport)
* [insertEmbedById](/visualizations-and-layouts/embedding/embed-sdk.md#insertembedbyid)

If you want to use those methods, you need to pass an authentication token when initializing the SDK. It requires an opaque token, follow the steps to [authenticate embeds](/visualizations-and-layouts/embedding/authentication.md).

As for the embed context, we recommend to use this payload:

{% code lineNumbers="true" %}

```javascript
{
  // You need these fields from the examples in the embed manager
  "iss": "https://<YOUR TENANT ID>-embed",
  "aud": "https://<YOUR INSTANCE URL>/api/auth/realms/<YOUR TENANT ID>",
  // Unix timestamp in seconds since 1970-01-01
  "exp": <TIMESTAMP_IN_FUTURE>,
  "jti": "<RANDOM_UNIQUE_ID>",
  "sub": "toucan-embed-client",
  "embed_context": {
    "username": "SDK_TOKEN",
    // to get from admin interface
    "workspace_id": "WORKSPACE_ID"
    "roles": ["ADMIN"],
    // ADMIN role grant access to all apps
    "privileges": {},
    "groups": [],
    "attributes": {}
  }
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs-v3.toucantoco.com/visualizations-and-layouts/embedding/embed-sdk/embed-sdk-authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
