Skip to content

Apps SDK — Preview API

Express Design Verify Token

API reference for the design.verifyToken method.

NOTE: This API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.

Usage: Extract design token from query parameter:

typescript
import { design, tokenExtractors } from '@canva/app-middleware/express';

app.get('/api/design/data', design.verifyToken({
  appId: 'your-app-id',
  tokenExtractor: tokenExtractors.fromQuery('design_token')
}), handler);

Parameters

<Prop.List> <Prop name="options" required state="preview" type="DesignAuthOptions" sourceLineNumbers={[26]}> Configuration options

&lt;PillAccordion defaultExpanded={true} title={&lt;&gt;Properties of &lt;strong&gt;options&lt;/strong&gt;&lt;/&gt;}&gt;
  &lt;Prop.List&gt;
    &lt;Prop name="appId" required type="string" sourceLineNumbers={[31]}&gt;
      The ID of the Canva app, obtained via the developer portal canva.com/developers.
    &lt;/Prop&gt;

    &lt;Prop name="tokenExtractor" required state="preview" type="TokenExtractor" sourceLineNumbers={[20]}&gt;
      A function that extracts the design JWT token from the request.
      Unlike user tokens, design tokens have no default extractor and must be
      explicitly configured based on how your app passes the design token.

      &lt;Prop.Extras&gt;
        **Example**

        ```typescript
        tokenExtractor: tokenExtractors.fromBearerAuth()
        tokenExtractor: tokenExtractors.fromQuery('design_token')
        tokenExtractor: tokenExtractors.fromHeader('X-Design-Token')
        ```
      &lt;/Prop.Extras&gt;

      **Parameters**

      &lt;Prop.List /&gt;

      **Returns**

      &lt;Tabs /&gt;
    &lt;/Prop&gt;

    &lt;Prop name="cacheMaxAgeMinutes" type="number" sourceLineNumbers={[36]}&gt;
      The maximum age of the JWKS cache in minutes.

      &lt;Prop.Extras&gt;
        **Default value**: `60`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;

    &lt;Prop name="timeoutMs" type="number" sourceLineNumbers={[41]}&gt;
      The timeout for the JWKS fetch in milliseconds.

      &lt;Prop.Extras&gt;
        **Default value**: `30000`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;

    &lt;Prop name="baseUrl" type="string" sourceLineNumbers={[46]}&gt;
      The base URL for the JWKS endpoint.

      &lt;Prop.Extras&gt;
        **Default value**: `"https://api.canva.com"`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;
  &lt;/Prop.List&gt;
&lt;/PillAccordion&gt;

</Prop> </Prop.List>

Returns

Express middleware that verifies design JWT tokens.

RequestHandler

Init Design Token Verifier

API reference for the initDesignTokenVerifier method.

NOTE: This API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.

Initializes a design token verifier with the given configuration.

Design tokens are JWTs that identify a specific Canva design. They are used to verify requests that need access to design-specific data.

The verifier caches JWKS public keys according to the configured cache settings. Create one verifier instance and reuse it for all verification requests.

Usage

Basic usage:

typescript
import { initDesignTokenVerifier } from '@canva/app-middleware';

// Initialize once at app startup
const designTokenVerifier = initDesignTokenVerifier({
  appId: process.env.CANVA_APP_ID,
});

// Verify tokens per request inside a handler
const payload = await designTokenVerifier.verify(token);
console.log(payload.designId, payload.appId);

With custom options:

typescript
const designTokenVerifier = initDesignTokenVerifier({
  appId: process.env.CANVA_APP_ID,
  cacheMaxAgeMinutes: 30,
  timeoutMs: 10000,
});

Parameters

<Prop.List> <Prop name="options" required state="preview" type="TokenVerifierOptions" sourceLineNumbers={[41]}> Configuration options for the verifier

&lt;PillAccordion defaultExpanded={true} title={&lt;&gt;Properties of &lt;strong&gt;options&lt;/strong&gt;&lt;/&gt;}&gt;
  &lt;Prop.List&gt;
    &lt;Prop name="appId" required type="string" sourceLineNumbers={[31]}&gt;
      The ID of the Canva app, obtained via the developer portal canva.com/developers.
    &lt;/Prop&gt;

    &lt;Prop name="cacheMaxAgeMinutes" type="number" sourceLineNumbers={[36]}&gt;
      The maximum age of the JWKS cache in minutes.

      &lt;Prop.Extras&gt;
        **Default value**: `60`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;

    &lt;Prop name="timeoutMs" type="number" sourceLineNumbers={[41]}&gt;
      The timeout for the JWKS fetch in milliseconds.

      &lt;Prop.Extras&gt;
        **Default value**: `30000`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;

    &lt;Prop name="baseUrl" type="string" sourceLineNumbers={[46]}&gt;
      The base URL for the JWKS endpoint.

      &lt;Prop.Extras&gt;
        **Default value**: `"https://api.canva.com"`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;
  &lt;/Prop.List&gt;
&lt;/PillAccordion&gt;

</Prop> </Prop.List>

Returns

A configured verifier instance.

<Prop.List> <Prop name="verify" required type="function" sourceLineNumbers={[86]}> Verifies a Canva design JWT token and returns the decoded payload.

**Parameters**

&lt;Prop.List&gt;
  &lt;Prop name="token" required type="string" sourceLineNumbers={[86]}&gt;
    The JWT token to verify
  &lt;/Prop&gt;
&lt;/Prop.List&gt;

**Returns**

The verified design token payload. This is a `Promise` that resolves with the following object:

&lt;Prop.List&gt;
  &lt;Prop name="appId" required type="string" sourceLineNumbers={[19]}&gt;
    The ID of the Canva app
  &lt;/Prop&gt;

  &lt;Prop name="designId" required type="string" sourceLineNumbers={[21]}&gt;
    The ID of the Canva design
  &lt;/Prop&gt;
&lt;/Prop.List&gt;

&lt;Prop.Extras&gt;
  **Throws**

  When the token is malformed or has an invalid signature

  **Throws**

  When the token has expired
&lt;/Prop.Extras&gt;

</Prop> </Prop.List>

Token Verification Error

API reference for the TokenVerificationError method.

NOTE: This API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.

Base class for all token verification errors. All token verification errors extend this class.

Constructors

<Prop.List> <Prop name="constructor" required type="function" sourceLineNumbers={[24]}> ### Constructor

#### Parameters

&lt;Prop.List&gt;
  &lt;Prop name="code" required state="preview" type="ErrorCode" sourceLineNumbers={[24]}&gt;
    An error code that identifies why an error was thrown by the app middleware.

    &lt;Prop.Extras&gt;
      **Available values**:

      * `"TOKEN_MISSING"`
      * `"TOKEN_EXPIRED"`
      * `"TOKEN_INVALID"`
    &lt;/Prop.Extras&gt;
  &lt;/Prop&gt;
&lt;/Prop.List&gt;

</Prop> </Prop.List>

Properties

<Prop.List> <Prop name="code" required state="preview" readonly type="ErrorCode" sourceLineNumbers={[21]}> Machine-readable error code

&lt;Prop.Extras&gt;
  **Available values**:

  * `"TOKEN_MISSING"`
  * `"TOKEN_EXPIRED"`
  * `"TOKEN_INVALID"`
&lt;/Prop.Extras&gt;

</Prop>

<Prop name="statusCode" required state="preview" readonly type="number" sourceLineNumbers={[23]}> HTTP status code to use when responding to the client </Prop> </Prop.List>

Methods

<Prop.List> <Prop name="[hasInstance]" required type="function" sourceLineNumbers={[17]}> Parameters

&lt;Prop.List /&gt;

**Returns**

`instance is TokenVerificationError`

</Prop> </Prop.List>

App Middleware Changelog

The latest changes for the Canva Apps SDK @canva/app-middleware@beta package.

v0.0.0-beta.5 - 2026-01-22

Added

  • Added design token authentication support with initDesignTokenVerifier() core function and design.verifyToken() Express middleware for verifying design-scoped requests.

Changed

  • Renamed UserAuthError to TokenVerificationError.

v0.0.0-beta.4 - 2026-01-15

Changed

  • Dependencies audit bringing modules up to date:
text
jsonwebtoken                               9.0.2   ->   9.0.3

Removed

  • Removed unused AppIdMismatchError class, which was never thrown.

v0.0.0-beta.3 - 2026-01-13

Changed

  • Replaced @public with @beta tags in TSDocs, while the SDK's still in beta.

v0.0.0-beta.2 - 2025-12-23

Added

  • Added new UserTokenVerifier type for the express/user namespace.

Changed

  • Various examples and documentation improvements in TSDocs.

Fixed

  • Fixed an issue where err instanceOf UserAuthError checks were failing across cjs/esm module boundaries.
  • Ensured error messages are logged in debug mode.
  • Token verification now only checks for claims that exist in the token.

v0.0.0-beta.1 - 2025-12-22

Added

  • Initial release of @canva/app-middleware.

Design Edit Content (Preview)

API reference for the editContent method.

NOTE: This API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.

Reads and edits content from the user's design.

Parameters

<Prop.List> <Prop name="options" required type="object" sourceLineNumbers={[3130]}> Options for configuring how a design is read. Must specify a content type.

&lt;PillAccordion defaultExpanded={true} title={&lt;&gt;Properties of &lt;strong&gt;options&lt;/strong&gt;&lt;/&gt;}&gt;
  &lt;Prop.List&gt;
    &lt;Prop name="target" required type="string" sourceLineNumbers={[1102]}&gt;
      The only valid value is `"current_page"`.
    &lt;/Prop&gt;

    &lt;Prop name="contentType" required type="T" sourceLineNumbers={[3131]}&gt;
      &lt;Prop.Extras&gt;
        **Available values**:

        * `"richtext"`
        * `"fill"`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;
  &lt;/Prop.List&gt;
&lt;/PillAccordion&gt;

</Prop>

<Prop name="callback" required type="function" sourceLineNumbers={[3130]}> A callback that receives a session for editing.

**Parameters**

&lt;Prop.List&gt;
  &lt;Prop name="session" required type="object" sourceLineNumbers={[3132]}&gt;
    &lt;Tabs&gt;
      &lt;Tab name="richtext"&gt;
        A callback for reading and updating the requested design content.

        &lt;Prop.Extras&gt;
          **Param: session**

          The result of reading the content in the design.

          **Examples**

          **Read and update richtext content**

          ```typescript
          import { editContent } from "@canva/design";

          await editContent(
            { contentType: 'richtext', target: 'current_page' },
            async (session) => {
              // Read the content
              const contents = session.contents;

              if (contents.length > 0) {
                const range = contents[0];

                // Modify the content (e.g., adding text)
                range.appendText("\nAppended text from app");

                // Sync changes back to the design
                await session.sync();
              }
            }
          );
          ```

          **Format all richtext content in the design**

          ```typescript
          import { editContent } from "@canva/design";

          await editContent(
            { contentType: 'richtext', target: 'current_page' },
            async (session) => {
              // Process each richtext range in the content
              for (const range of session.contents) {
                // Skip if the content has been deleted
                if (range.deleted) continue;

                // Get the text content
                const text = range.readPlaintext();
                if (text.length === 0) continue;

                // Apply consistent formatting
                range.formatParagraph(
                  { index: 0, length: text.length },
                  {
                    fontRef: 'YOUR_FONT_REF',
                    fontSize: 16,
                    textAlign: 'start'
                  }
                );
              }

              // Sync all changes back to the design
              await session.sync();
            }
          );
          ```

          **Modify content without saving changes**

          ```typescript
          import { editContent } from "@canva/design";

          await editContent(
            { contentType: 'richtext', target: 'current_page' },
            async (session) => {
              // Read and analyze the content without making changes
              for (const range of session.contents) {
                const text = range.readPlaintext();
                // Do something with the content preview, e.g. `text.substring(0, 50)`

                // No call to session.sync() means no changes are saved
              }

              // Since we're not calling sync(), no changes will be made to the design
            }
          );
          ```
        &lt;/Prop.Extras&gt;

        &lt;Prop.List&gt;
          &lt;Prop name="contents" required readonly type="RichtextContentRange[]" sourceLineNumbers={[4294]}&gt;
            Richtext content in the design.

            &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;contents&lt;/strong&gt;&lt;/&gt;}&gt;
              &lt;Prop.List&gt;
                &lt;Prop name="deleted" required readonly type="boolean" sourceLineNumbers={[4206]}&gt;
                  Indicates whether the object containing this richtext range has been deleted.
                &lt;/Prop&gt;

                &lt;Prop name="formatParagraph" required type="function" sourceLineNumbers={[4447]}&gt;
                  Formats all of the paragraphs that overlap the given bounds.

                  * The `\n` character indicates the end of a paragraph.
                  * All paragraphs that overlap the provided bounds will be formatted in their entirety.

                  **Parameters**

                  &lt;Prop.List&gt;
                    &lt;Prop name="bounds" required type="Bounds" sourceLineNumbers={[4447]}&gt;
                      The segment of the range on which to apply the formatting.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;bounds&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="index" required type="number" sourceLineNumbers={[889]}&gt;
                            The starting position of the segment.

                            This is zero-based, meaning the first character of the range is at index 0.
                          &lt;/Prop&gt;

                          &lt;Prop name="length" required type="number" sourceLineNumbers={[893]}&gt;
                            The number of characters in the segment, starting from the index.
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;

                    &lt;Prop name="formatting" required type="RichtextFormatting" sourceLineNumbers={[4447]}&gt;
                      The formatting to apply to the paragraph(s).

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;formatting&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="color" type="string" sourceLineNumbers={[3807]}&gt;
                            The color of the text as a hex code.

                            The hex code must include all six characters and be prefixed with a `#` symbol.

                            &lt;Prop.Extras&gt;
                              **Example**

                              ```ts
                              "#ff0099"
                              ```
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontWeight" type="FontWeight" sourceLineNumbers={[3816]}&gt;
                            The weight (thickness) of the font.

                            The available font weights depend on the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"thin"`
                              * `"extralight"`
                              * `"light"`
                              * `"medium"`
                              * `"semibold"`
                              * `"bold"`
                              * `"ultrabold"`
                              * `"heavy"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontStyle" type="string" sourceLineNumbers={[3821]}&gt;
                            The style of the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"italic"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="decoration" type="string" sourceLineNumbers={[3826]}&gt;
                            The decoration of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"underline"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="strikethrough" type="string" sourceLineNumbers={[3831]}&gt;
                            The strikethrough of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"strikethrough"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="link" type="string" sourceLineNumbers={[3835]}&gt;
                            An external URL that the text links to.
                          &lt;/Prop&gt;

                          &lt;Prop name="fontRef" type="FontRef" sourceLineNumbers={[4365]}&gt;
                            A unique identifier that points to a font asset in Canva's backend.
                          &lt;/Prop&gt;

                          &lt;Prop name="fontSize" type="number" sourceLineNumbers={[4374]}&gt;
                            The size of the text, in pixels.

                            * In the Canva editor, this number is shown as points (pts), not pixels.

                            &lt;Prop.Extras&gt;
                              **Minimum**: `1`

                              **Maximum**: `100`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="textAlign" type="string" sourceLineNumbers={[4379]}&gt;
                            The alignment of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"start"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"start"`
                              * `"center"`
                              * `"end"`
                              * `"justify"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="listLevel" type="number" sourceLineNumbers={[4383]}&gt;
                            The list indentation level of the paragraph.
                          &lt;/Prop&gt;

                          &lt;Prop name="listMarker" type="string" sourceLineNumbers={[4392]}&gt;
                            The appearance of list item markers.

                            This property only has an effect if `listLevel` is greater than 0.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"disc"`
                              * `"circle"`
                              * `"square"`
                              * `"decimal"`
                              * `"lower-alpha"`
                              * `"lower-roman"`
                              * `"checked"`
                              * `"unchecked"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;
                  &lt;/Prop.List&gt;

                  **Returns**

                  `void`

                  &lt;Prop.Extras&gt;
                    **Examples**

                    **Format paragraph as a heading**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();

                    range.appendText("Heading Text\nRegular paragraph text.");

                    // Format just the first paragraph as a heading
                    range.formatParagraph(
                      { index: 0, length: 12 }, // Only need to include part of the paragraph
                      {
                        fontSize: 24,
                        fontWeight: 'bold',
                        textAlign: 'center'
                      }
                    );
                    ```

                    **Create a bulleted list**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    const text = "Item 1\nItem 2\nItem 3";
                    range.appendText(text);

                    // Format all paragraphs as a bulleted list
                    range.formatParagraph(
                      { index: 0, length: text.length },
                      {
                        listLevel: 1,
                        listMarker: 'disc'
                      }
                    );
                    ```
                  &lt;/Prop.Extras&gt;
                &lt;/Prop&gt;

                &lt;Prop name="formatText" required type="function" sourceLineNumbers={[4489]}&gt;
                  Formats a region of text with inline formatting properties.

                  **Parameters**

                  &lt;Prop.List&gt;
                    &lt;Prop name="bounds" required type="Bounds" sourceLineNumbers={[4489]}&gt;
                      The segment of the range on which to apply the formatting.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;bounds&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="index" required type="number" sourceLineNumbers={[889]}&gt;
                            The starting position of the segment.

                            This is zero-based, meaning the first character of the range is at index 0.
                          &lt;/Prop&gt;

                          &lt;Prop name="length" required type="number" sourceLineNumbers={[893]}&gt;
                            The number of characters in the segment, starting from the index.
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;

                    &lt;Prop name="formatting" required type="InlineFormatting" sourceLineNumbers={[4489]}&gt;
                      The formatting to apply to the text.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;formatting&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="color" type="string" sourceLineNumbers={[3807]}&gt;
                            The color of the text as a hex code.

                            The hex code must include all six characters and be prefixed with a `#` symbol.

                            &lt;Prop.Extras&gt;
                              **Example**

                              ```ts
                              "#ff0099"
                              ```
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontWeight" type="FontWeight" sourceLineNumbers={[3816]}&gt;
                            The weight (thickness) of the font.

                            The available font weights depend on the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"thin"`
                              * `"extralight"`
                              * `"light"`
                              * `"medium"`
                              * `"semibold"`
                              * `"bold"`
                              * `"ultrabold"`
                              * `"heavy"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontStyle" type="string" sourceLineNumbers={[3821]}&gt;
                            The style of the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"italic"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="decoration" type="string" sourceLineNumbers={[3826]}&gt;
                            The decoration of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"underline"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="strikethrough" type="string" sourceLineNumbers={[3831]}&gt;
                            The strikethrough of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"strikethrough"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="link" type="string" sourceLineNumbers={[3835]}&gt;
                            An external URL that the text links to.
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;
                  &lt;/Prop.List&gt;

                  **Returns**

                  `void`

                  &lt;Prop.Extras&gt;
                    **Examples**

                    **Format specific words in a paragraph**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("This text contains important information.");

                    // Format just the word "important"
                    range.formatText(
                      { index: 16, length: 9 },
                      {
                        fontWeight: 'bold',
                        color: '#FF0000'
                      }
                    );
                    ```

                    **Add a link to text**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("Visit our website for more information.");

                    // Add a link to "our website"
                    range.formatText(
                      { index: 6, length: 11 },
                      {
                        link: "https://www.example.com",
                        decoration: 'underline',
                        color: '#0066CC'
                      }
                    );
                    ```
                  &lt;/Prop.Extras&gt;
                &lt;/Prop&gt;

                &lt;Prop name="appendText" required type="function" sourceLineNumbers={[4527]}&gt;
                  Appends the specified characters to the end of the range.

                  **Parameters**

                  &lt;Prop.List&gt;
                    &lt;Prop name="characters" required type="string" sourceLineNumbers={[4527]}&gt;
                      The characters to append to the richtext range.
                    &lt;/Prop&gt;

                    &lt;Prop name="formatting" type="InlineFormatting" sourceLineNumbers={[4527]}&gt;
                      Optional formatting to apply to the appended text.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;formatting&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="color" type="string" sourceLineNumbers={[3807]}&gt;
                            The color of the text as a hex code.

                            The hex code must include all six characters and be prefixed with a `#` symbol.

                            &lt;Prop.Extras&gt;
                              **Example**

                              ```ts
                              "#ff0099"
                              ```
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontWeight" type="FontWeight" sourceLineNumbers={[3816]}&gt;
                            The weight (thickness) of the font.

                            The available font weights depend on the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"thin"`
                              * `"extralight"`
                              * `"light"`
                              * `"medium"`
                              * `"semibold"`
                              * `"bold"`
                              * `"ultrabold"`
                              * `"heavy"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontStyle" type="string" sourceLineNumbers={[3821]}&gt;
                            The style of the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"italic"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="decoration" type="string" sourceLineNumbers={[3826]}&gt;
                            The decoration of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"underline"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="strikethrough" type="string" sourceLineNumbers={[3831]}&gt;
                            The strikethrough of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"strikethrough"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="link" type="string" sourceLineNumbers={[3835]}&gt;
                            An external URL that the text links to.
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;
                  &lt;/Prop.List&gt;

                  **Returns**

                  &lt;Prop.List&gt;
                    &lt;Prop name="bounds" required type="Bounds" sourceLineNumbers={[4528]}&gt;
                      A segment of a richtext range.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;bounds&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="index" required type="number" sourceLineNumbers={[889]}&gt;
                            The starting position of the segment.

                            This is zero-based, meaning the first character of the range is at index 0.
                          &lt;/Prop&gt;

                          &lt;Prop name="length" required type="number" sourceLineNumbers={[893]}&gt;
                            The number of characters in the segment, starting from the index.
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;
                  &lt;/Prop.List&gt;

                  &lt;Prop.Extras&gt;
                    **Examples**

                    **Append plain text**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("First paragraph. ");

                    // Append more text to the existing content
                    const result = range.appendText("This is additional text.");

                    // The bounds of the newly added text are returned
                    // Do something with the bounds - result.bounds, e.g. { index: 17, length: 24 }
                    ```

                    **Append formatted text**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("Normal text followed by ");

                    // Append formatted text
                    range.appendText("bold red text", {
                      fontWeight: 'bold',
                      color: '#FF0000'
                    });

                    // Append a new paragraph
                    range.appendText("\nThis is a new paragraph.");
                    ```
                  &lt;/Prop.Extras&gt;
                &lt;/Prop&gt;

                &lt;Prop name="replaceText" required type="function" sourceLineNumbers={[4573]}&gt;
                  Replaces a region of text with the specified characters.

                  **Parameters**

                  &lt;Prop.List&gt;
                    &lt;Prop name="bounds" required type="Bounds" sourceLineNumbers={[4573]}&gt;
                      The segment of the range to replace.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;bounds&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="index" required type="number" sourceLineNumbers={[889]}&gt;
                            The starting position of the segment.

                            This is zero-based, meaning the first character of the range is at index 0.
                          &lt;/Prop&gt;

                          &lt;Prop name="length" required type="number" sourceLineNumbers={[893]}&gt;
                            The number of characters in the segment, starting from the index.
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;

                    &lt;Prop name="characters" required type="string" sourceLineNumbers={[4573]}&gt;
                      The replacement characters.
                    &lt;/Prop&gt;

                    &lt;Prop name="formatting" type="InlineFormatting" sourceLineNumbers={[4573]}&gt;
                      The formatting to apply to the replaced text.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;formatting&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="color" type="string" sourceLineNumbers={[3807]}&gt;
                            The color of the text as a hex code.

                            The hex code must include all six characters and be prefixed with a `#` symbol.

                            &lt;Prop.Extras&gt;
                              **Example**

                              ```ts
                              "#ff0099"
                              ```
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontWeight" type="FontWeight" sourceLineNumbers={[3816]}&gt;
                            The weight (thickness) of the font.

                            The available font weights depend on the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"thin"`
                              * `"extralight"`
                              * `"light"`
                              * `"medium"`
                              * `"semibold"`
                              * `"bold"`
                              * `"ultrabold"`
                              * `"heavy"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontStyle" type="string" sourceLineNumbers={[3821]}&gt;
                            The style of the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"italic"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="decoration" type="string" sourceLineNumbers={[3826]}&gt;
                            The decoration of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"underline"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="strikethrough" type="string" sourceLineNumbers={[3831]}&gt;
                            The strikethrough of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"strikethrough"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="link" type="string" sourceLineNumbers={[3835]}&gt;
                            An external URL that the text links to.
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;
                  &lt;/Prop.List&gt;

                  **Returns**

                  &lt;Prop.List&gt;
                    &lt;Prop name="bounds" required type="Bounds" sourceLineNumbers={[4577]}&gt;
                      The bounds of the replacement characters within the updated range.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;bounds&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="index" required type="number" sourceLineNumbers={[889]}&gt;
                            The starting position of the segment.

                            This is zero-based, meaning the first character of the range is at index 0.
                          &lt;/Prop&gt;

                          &lt;Prop name="length" required type="number" sourceLineNumbers={[893]}&gt;
                            The number of characters in the segment, starting from the index.
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;
                  &lt;/Prop.List&gt;

                  &lt;Prop.Extras&gt;
                    **Examples**

                    **Replace text while maintaining some formatting**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("This text needs correction.");

                    // Replace "needs correction" with "is correct"
                    const result = range.replaceText(
                      { index: 10, length: 16 },
                      "is correct"
                    );

                    // The bounds of the replaced text are returned
                    // Do something with the bounds - result.bounds, e.g. { index: 10, length: 10 }
                    ```

                    **Replace text with formatted text**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("Regular text that needs emphasis.");

                    // Replace "needs emphasis" with formatted text
                    range.replaceText(
                      { index: 17, length: 15 },
                      "is important",
                      {
                        fontWeight: 'bold',
                        fontStyle: 'italic',
                        color: '#0066CC'
                      }
                    );
                    ```
                  &lt;/Prop.Extras&gt;
                &lt;/Prop&gt;

                &lt;Prop name="readPlaintext" required type="function" sourceLineNumbers={[4616]}&gt;
                  Returns the current state of the richtext as plaintext.

                  **Returns**

                  `string`

                  &lt;Prop.Extras&gt;
                    **Examples**

                    **Extract plain text content**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("First paragraph.\n", { fontWeight: 'bold' });
                    range.appendText("Second paragraph with formatting.", { color: '#FF0000' });

                    // Get plain text content without formatting
                    const plainText = range.readPlaintext();
                    // Do something with the plain text - plainText, e.g. "First paragraph.\nSecond paragraph with formatting."
                    ```

                    **Search within text content**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("This text contains a searchable term.");

                    // Search for a specific word
                    const plainText = range.readPlaintext();
                    const searchTerm = "searchable";
                    const index = plainText.indexOf(searchTerm);

                    if (index !== -1) {
                      // Format the found term
                      range.formatText(
                        { index, length: searchTerm.length },
                        { fontWeight: 'bold', decoration: 'underline' }
                      );
                    }
                    ```
                  &lt;/Prop.Extras&gt;
                &lt;/Prop&gt;

                &lt;Prop name="readTextRegions" required type="function" sourceLineNumbers={[4663]}&gt;
                  Returns the current state of the richtext as one or more text regions.
                  Each region is an object that contains the text content and its formatting.

                  **Returns**

                  &lt;Prop.List&gt;
                    &lt;Prop name="text" required type="string" sourceLineNumbers={[5146]}&gt;
                      The plaintext content of the region.
                    &lt;/Prop&gt;

                    &lt;Prop name="formatting" type="Partial&lt;RichtextFormatting&gt;" sourceLineNumbers={[5150]}&gt;
                      The formatting of the region.

                      &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;formatting&lt;/strong&gt;&lt;/&gt;}&gt;
                        &lt;Prop.List&gt;
                          &lt;Prop name="color" type="string" sourceLineNumbers={[3807]}&gt;
                            The color of the text as a hex code.

                            The hex code must include all six characters and be prefixed with a `#` symbol.

                            &lt;Prop.Extras&gt;
                              **Example**

                              ```ts
                              "#ff0099"
                              ```
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontWeight" type="FontWeight" sourceLineNumbers={[3816]}&gt;
                            The weight (thickness) of the font.

                            The available font weights depend on the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"thin"`
                              * `"extralight"`
                              * `"light"`
                              * `"medium"`
                              * `"semibold"`
                              * `"bold"`
                              * `"ultrabold"`
                              * `"heavy"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="fontStyle" type="string" sourceLineNumbers={[3821]}&gt;
                            The style of the font.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"normal"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"normal"`
                              * `"italic"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="decoration" type="string" sourceLineNumbers={[3826]}&gt;
                            The decoration of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"underline"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="strikethrough" type="string" sourceLineNumbers={[3831]}&gt;
                            The strikethrough of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"strikethrough"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="link" type="string" sourceLineNumbers={[3835]}&gt;
                            An external URL that the text links to.
                          &lt;/Prop&gt;

                          &lt;Prop name="fontRef" type="FontRef" sourceLineNumbers={[4365]}&gt;
                            A unique identifier that points to a font asset in Canva's backend.
                          &lt;/Prop&gt;

                          &lt;Prop name="fontSize" type="number" sourceLineNumbers={[4374]}&gt;
                            The size of the text, in pixels.

                            * In the Canva editor, this number is shown as points (pts), not pixels.

                            &lt;Prop.Extras&gt;
                              **Minimum**: `1`

                              **Maximum**: `100`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="textAlign" type="string" sourceLineNumbers={[4379]}&gt;
                            The alignment of the text.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"start"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"start"`
                              * `"center"`
                              * `"end"`
                              * `"justify"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;

                          &lt;Prop name="listLevel" type="number" sourceLineNumbers={[4383]}&gt;
                            The list indentation level of the paragraph.
                          &lt;/Prop&gt;

                          &lt;Prop name="listMarker" type="string" sourceLineNumbers={[4392]}&gt;
                            The appearance of list item markers.

                            This property only has an effect if `listLevel` is greater than 0.

                            &lt;Prop.Extras&gt;
                              **Default value**: `"none"`
                            &lt;/Prop.Extras&gt;

                            &lt;Prop.Extras&gt;
                              **Available values**:

                              * `"none"`
                              * `"disc"`
                              * `"circle"`
                              * `"square"`
                              * `"decimal"`
                              * `"lower-alpha"`
                              * `"lower-roman"`
                              * `"checked"`
                              * `"unchecked"`
                            &lt;/Prop.Extras&gt;
                          &lt;/Prop&gt;
                        &lt;/Prop.List&gt;
                      &lt;/PillAccordion&gt;
                    &lt;/Prop&gt;
                  &lt;/Prop.List&gt;

                  &lt;Prop.Extras&gt;
                    **Examples**

                    **Get text with formatting information**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("Normal text ", {});
                    range.appendText("bold text", { fontWeight: 'bold' });
                    range.appendText(" and ", {});
                    range.appendText("red text", { color: '#FF0000' });

                    // Get formatted regions
                    const regions = range.readTextRegions();
                    // Do something with the regions, e.g.
                    // [
                    //   { text: "Normal text ", formatting: {} },
                    //   { text: "bold text", formatting: { fontWeight: 'bold' } },
                    //   { text: " and ", formatting: {} },
                    //   { text: "red text", formatting: { color: '#FF0000' } }
                    // ]
                    ```

                    **Analyze formatting variations**

                    ```typescript
                    import { createRichtextRange } from "@canva/design";

                    const range = createRichtextRange();
                    range.appendText("Mixed ", {});
                    range.appendText("formatted ", { fontWeight: 'bold' });
                    range.appendText("text", { color: '#0066CC' });

                    // Analyze formatting variations
                    const regions = range.readTextRegions();
                    const formattingTypes = regions.map(region => {
                      const formatting = region.formatting || {};
                      return {
                        text: region.text,
                        hasWeight: !!formatting.fontWeight,
                        hasColor: !!formatting.color
                      };
                    });
                    ```
                  &lt;/Prop.Extras&gt;
                &lt;/Prop&gt;
              &lt;/Prop.List&gt;
            &lt;/PillAccordion&gt;
          &lt;/Prop&gt;

          &lt;Prop name="sync" required type="function" sourceLineNumbers={[4326]}&gt;
            Saves any changes made during the session while keeping the transaction open.

            * Any changes in the session are only reflected in the design after this method is called.
            * Once this method is called, further changes in the session can still be made.

            **Returns**

            `Promise&lt;void&gt;`

            &lt;Prop.Extras&gt;
              **Example: Sync changes after modifying content**

              ```typescript
              import { editContent } from "@canva/design";

              await editContent(
                { contentType: 'richtext', target: 'current_page' },
                async (session) => {
                  if (session.contents.length > 0) {
                    const range = session.contents[0];

                    // Make modifications to the content
                    range.appendText(" - Modified by app");

                    try {
                      // Save changes back to the design
                      await session.sync();
                    } catch (error) {
                      console.error('Failed to sync changes:', error);
                    }
                  }
                }
              );
              ```
            &lt;/Prop.Extras&gt;
          &lt;/Prop&gt;
        &lt;/Prop.List&gt;
      &lt;/Tab&gt;

      &lt;Tab name="fill" icon={&lt;StateIndicator state="preview" /&gt;}&gt;
        Session for reading and updating fill content in a user's design.

        &lt;Prop.List&gt;
          &lt;Prop name="contents" required state="preview" readonly type="FillContent[]" sourceLineNumbers={[3472]}&gt;
            Fill content in the design.

            &lt;Tabs&gt;
              &lt;Tab name="image"&gt;
                &lt;Prop.List&gt;
                  &lt;Prop name="type" required type="string" sourceLineNumbers={[3429]}&gt;
                    The only valid value is `"image"`.
                  &lt;/Prop&gt;

                  &lt;Prop name="ref" required type="ImageRef" sourceLineNumbers={[3433]}&gt;
                    A unique identifier that points to an image asset in Canva's backend.
                  &lt;/Prop&gt;

                  &lt;Prop name="deleted" required type="boolean" sourceLineNumbers={[3444]}&gt;
                    Indicates whether the object containing this fill has been deleted.
                  &lt;/Prop&gt;

                  &lt;Prop name="altText" type="AltText" sourceLineNumbers={[3440]}&gt;
                    A description of the image content.

                    Use `undefined` for content with no description.

                    &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;altText&lt;/strong&gt;&lt;/&gt;}&gt;
                      &lt;Prop.List&gt;
                        &lt;Prop name="text" required type="string" sourceLineNumbers={[397]}&gt;
                          The text content.
                        &lt;/Prop&gt;

                        &lt;Prop name="decorative" required type="boolean | undefined" sourceLineNumbers={[405]}&gt;
                          Indicates where the alternative text should be displayed.

                          * If `true`, the alternative text will only be displayed in the editor.
                          * If `false`, the alternative text will be displayed in the editor and in view-only mode.
                        &lt;/Prop&gt;
                      &lt;/Prop.List&gt;
                    &lt;/PillAccordion&gt;
                  &lt;/Prop&gt;
                &lt;/Prop.List&gt;
              &lt;/Tab&gt;

              &lt;Tab name="video"&gt;
                &lt;Prop.List&gt;
                  &lt;Prop name="type" required type="string" sourceLineNumbers={[3446]}&gt;
                    The only valid value is `"video"`.
                  &lt;/Prop&gt;

                  &lt;Prop name="ref" required type="VideoRef" sourceLineNumbers={[3450]}&gt;
                    A unique identifier that points to an video asset in Canva's backend.
                  &lt;/Prop&gt;

                  &lt;Prop name="deleted" required type="boolean" sourceLineNumbers={[3461]}&gt;
                    Indicates whether the object containing this fill has been deleted.
                  &lt;/Prop&gt;

                  &lt;Prop name="altText" type="AltText" sourceLineNumbers={[3457]}&gt;
                    A description of the video content.

                    Use `undefined` for content with no description.

                    &lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;altText&lt;/strong&gt;&lt;/&gt;}&gt;
                      &lt;Prop.List&gt;
                        &lt;Prop name="text" required type="string" sourceLineNumbers={[397]}&gt;
                          The text content.
                        &lt;/Prop&gt;

                        &lt;Prop name="decorative" required type="boolean | undefined" sourceLineNumbers={[405]}&gt;
                          Indicates where the alternative text should be displayed.

                          * If `true`, the alternative text will only be displayed in the editor.
                          * If `false`, the alternative text will be displayed in the editor and in view-only mode.
                        &lt;/Prop&gt;
                      &lt;/Prop.List&gt;
                    &lt;/PillAccordion&gt;
                  &lt;/Prop&gt;
                &lt;/Prop.List&gt;
              &lt;/Tab&gt;
            &lt;/Tabs&gt;
          &lt;/Prop&gt;

          &lt;Prop name="sync" required type="function" sourceLineNumbers={[3480]}&gt;
            * Any changes in the session are only reflected in the design after this method is called.
            * Once this method is called, further changes in the session can still be made.

            **Returns**

            `Promise&lt;void&gt;`
          &lt;/Prop&gt;
        &lt;/Prop.List&gt;
      &lt;/Tab&gt;
    &lt;/Tabs&gt;
  &lt;/Prop&gt;
&lt;/Prop.List&gt;

**Returns**

`void` or `Promise&lt;void&gt;`

</Prop> </Prop.List>

Returns

A promise that resolves when editing is complete.

Promise&lt;void&gt;

Get Design Template Metadata

API reference for the getDesignTemplateMetadata method.

NOTE: This API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.

Retrieves information about the template that was used in a design.

Usage: Get design template metadata

typescript
import { getDesignTemplateMetadata } from "@canva/design";

const templateMetadata = await getDesignTemplateMetadata();

const { keywords, domain } = templateMetadata;

Returns

Information about the template that was used in a design. This is a Promise that resolves with the following object:

<Prop.List> <Prop name="templates" type="Iterable<TemplateMetadata>" sourceLineNumbers={[3067]}> The templates applied to the pages within the design.

&lt;PillAccordion defaultExpanded={false} title={&lt;&gt;Properties of &lt;strong&gt;templates&lt;/strong&gt;&lt;/&gt;}&gt;
  &lt;Prop.List&gt;
    &lt;Prop name="keywords" required type="string[]" sourceLineNumbers={[5000]}&gt;
      A list of keywords contained in a template.
    &lt;/Prop&gt;

    &lt;Prop name="domain" required type="string" sourceLineNumbers={[5004]}&gt;
      Determines the domain of the template. This could be public, brand or personal.

      &lt;Prop.Extras&gt;
        **Available values**:

        * `"public"`
        * `"brand"`
        * `"personal"`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;
  &lt;/Prop.List&gt;
&lt;/PillAccordion&gt;

</Prop> </Prop.List>

Features Is Supported

API reference for the features.isSupported method.

Checks if the specified SDK methods are supported in the current context.

Usage

Checking a single feature

typescript
import { features } from '@canva/platform';
import { addElementAtPoint } from '@canva/design';

const isSupported = features.isSupported(addElementAtPoint);

Checking multiple features

typescript
import { features } from '@canva/platform';
import { addElementAtPoint, addElementAtCursor } from '@canva/design';

const areSupported = features.isSupported(addElementAtPoint, addElementAtCursor);

Parameters

<Prop.List> <Prop name="features" required type="Feature[]" sourceLineNumbers={[417]}> The SDK methods to be checked for support. </Prop> </Prop.List>

Returns

boolean

Add Toast (Preview)

API reference for the notification.addToast method.

A method that shows a toast notification to the user.

Usage

tsx
import { notification } from '@canva/platform';
import type { ToastRequest } from '@canva/platform';

const showToast = () => {
  const request: ToastRequest = {
    messageText: "Hello world!",
  };
  notification.addToast(request);
};

<Button onClick={() => showToast()}>Show Toast</Button>

Parameters

<Prop.List> <Prop name="request" required type="ToastRequest" sourceLineNumbers={[499]}> Options for configuring a toast notification.

&lt;PillAccordion defaultExpanded={true} title={&lt;&gt;Properties of &lt;strong&gt;request&lt;/strong&gt;&lt;/&gt;}&gt;
  &lt;Prop.List&gt;
    &lt;Prop name="messageText" required type="string" sourceLineNumbers={[684]}&gt;
      Text to show within the toast notification.
    &lt;/Prop&gt;

    &lt;Prop name="timeoutMs" type="number | string" sourceLineNumbers={[694]}&gt;
      The duration that the notification will be visible.

      If set to `"infinite"`, the notification will be displayed until manually dismissed by the user.

      If set to a number, the notification will automatically disappear after that duration (in milliseconds).

      &lt;Prop.Extras&gt;
        **Default value**: `5000`
      &lt;/Prop.Extras&gt;
    &lt;/Prop&gt;
  &lt;/Prop.List&gt;
&lt;/PillAccordion&gt;

</Prop> </Prop.List>

Returns

The result when a toast notification is successfully added. This is a Promise that resolves with the following object:

<Prop.List> <Prop name="status" required type="string" sourceLineNumbers={[672]}> The status of the request.

The only valid value is `"completed"`.

</Prop> </Prop.List>

Canva Developer Documentation SOP Site