Components

Create components

Creates one or more library components in your workspace.

The operation is all-or-nothing: if any component is invalid, none are created.

post/components

Request

  • Base URL: https://api.dittowords.com/v2
  • URL: https://api.dittowords.com/v2/components
  • Auth: API key in header Authorization

Request body

richText'html'

When set to 'html', all text values in this request (including plural and variant text) are parsed as HTML and saved as rich text. Supported formatting: <strong>/<b>, <em>/<i>, <u>, <s>, and <br> for line breaks. <sup> and <sub> are only supported for workspaces with superscript and subscript enabled. Unsupported markup (for example links, lists, or headings) is dropped and its text content kept.

Note: Fully-bolded strings will have that bold styling stripped, as Figma does not support bolding an entire text layer this way.

When omitted, text is saved as plaintext and any markup is stored literally.

Example request

{
  "components": [
    {
      "text": "Hello world",
      "name": "Component One"
    },
    {
      "developerId": "custom-id",
      "text": "Custom ID example",
      "name": "Custom Component",
      "notes": "For the homepage CTA",
      "characterLimit": 80
    },
    {
      "text": "In folder",
      "name": "Folder Component",
      "folderId": "my-folder-id"
    },
    {
      "text": "{{count}} items in your cart",
      "name": "Cart Count",
      "variables": [
        "count"
      ],
      "plurals": [
        {
          "form": "one",
          "text": "{{count}} item in your cart"
        },
        {
          "form": "other",
          "text": "{{count}} items in your cart"
        }
      ]
    },
    {
      "text": "Hello world",
      "name": "Localized Component",
      "variants": [
        {
          "variantId": "french",
          "text": "Bonjour le monde"
        }
      ]
    }
  ]
}

Response

Returns the developer IDs of the created components

developerIdsstring[] required

Array of developer IDs for the created components

Example response

{
  "developerIds": [
    "component-one",
    "custom-id",
    "folder-component"
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.