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

# Update Widget Settings

> Set the allowed origins and the master templates. Call it once before the first send with a tenant

Guide: [Quickstart](https://docs.minimo.it/embedded/quickstart.md). Errors: [Errors and limits](https://docs.minimo.it/embedded/errors.md).


## OpenAPI

````yaml put /public/v1/widgets/settings
openapi: 3.1.0
info:
  title: API Documentation
  description: Documentation for transactional and subscribe APIs
  version: 1.0.0
servers:
  - url: https://app.minimo.it
security:
  - bearerAuth: []
paths:
  /public/v1/widgets/settings:
    servers:
      - url: https://api.minimo.it
    put:
      summary: Update widget settings
      description: >-
        Call it once before the first send with a `tenant`: it turns on
        restaurants for your workspace.


        Each field replaces its list. Omit a field to keep it. The origins are
        shared with the domain popup.
      operationId: updateWidgetSettings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                allowedOrigins:
                  type: array
                  items:
                    type: string
                  description: >-
                    Exact origins of the pages that embed the widgets
                    (`scheme://host[:port]`). Replaces the list.
                masterTemplateIds:
                  type: array
                  items:
                    oneOf:
                      - type: integer
                      - type: string
                  description: >-
                    Your master templates, each by id or uid: automatic messages
                    (service emails) and campaign starters. Replaces the list.
            example:
              allowedOrigins:
                - https://app.example.com
                - http://localhost:3000
              masterTemplateIds:
                - TRF4MS9
                - RMD2HRS
      responses:
        '200':
          description: The saved settings
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/WidgetSettings'
              example:
                data:
                  allowedOrigins:
                    - https://app.example.com
                    - http://localhost:3000
                  masterTemplateIds:
                    - 1201
                    - 1202
                  masterTemplateUids:
                    - TRF4MS9
                    - RMD2HRS
        '400':
          description: '`INVALID_PARAMETERS`: an origin or a template is not valid.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: >-
            `INVALID_TOKEN`: missing or wrong key, or a key without the
            **Widgets** permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: >-
            `MASTER_LOOKS_PROMOTIONAL`: a template marked as a service email
            reads like a promotion.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - bearerAuth: []
      x-codeSamples:
        - label: cURL
          lang: bash
          source: |-
            curl --request PUT \
              --url 'https://api.minimo.it/public/v1/widgets/settings' \
              --header 'Authorization: Bearer YOUR_MINIMO_KEY' \
              --header 'Content-Type: application/json' \
              --data '{"allowedOrigins": ["https://app.example.com"], "masterTemplateIds": ["TRF4MS9", "RMD2HRS"]}'
        - lang: JavaScript
          source: >-
            const res = await
            fetch('https://api.minimo.it/public/v1/widgets/settings', {
              method: 'PUT',
              headers: {
                Authorization: 'Bearer YOUR_MINIMO_KEY',
                'Content-Type': 'application/json',
              },
              body: JSON.stringify({"allowedOrigins": ["https://app.example.com"], "masterTemplateIds": ["TRF4MS9", "RMD2HRS"]}),
            });

            const { data } = await res.json();

            console.log(data);
        - lang: Python
          source: |-
            import requests

            res = requests.put(
                'https://api.minimo.it/public/v1/widgets/settings',
                headers={'Authorization': 'Bearer YOUR_MINIMO_KEY'},
                json={"allowedOrigins": ["https://app.example.com"], "masterTemplateIds": ["TRF4MS9", "RMD2HRS"]},
            )
            print(res.status_code, res.text)
components:
  schemas:
    WidgetSettings:
      type: object
      properties:
        allowedOrigins:
          type: array
          items:
            type: string
          example:
            - https://app.example.com
          description: Origins of the pages that embed the widgets and the domain popup.
        masterTemplateIds:
          type: array
          items:
            type: integer
          example:
            - 1201
            - 1202
          description: Your master templates, by id.
        masterTemplateUids:
          type: array
          items:
            type: string
          example:
            - TRF4MS9
            - RMD2HRS
          description: The same templates, by uid.
      required:
        - allowedOrigins
        - masterTemplateIds
        - masterTemplateUids
    ApiError:
      type: object
      properties:
        status:
          type: string
          example: FAIL
        message:
          type: string
          description: The error code to test in your code.
          example: INVALID_PARAMETERS
        userMessage:
          type: string
          description: >-
            When present, a sentence that says what to fix. You can show or log
            it.
          example: Set the origins allowed to embed the widgets first.
      description: >-
        Every error has this shape. See [Errors and limits](/embedded/errors)
        for every code.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: mn-API_CLIENT_ID-API_KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.