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

# Update notification settings

> Set your boxes and change the workspace's channels in one go.

> [!NOTE]
>
> Needs `notifications:update`. Anyone in the workspace can set their own boxes. Changing a channel also needs a role that can manage notifications (owners and managers), in its workspace and in every workspace it also sends events from. See [Permissions](https://docs.postsyncer.com/essentials/authentication.md#permissions).

* `preferences`: your own boxes, each an `event`, a `channel` (`in_app`, `email`, `telegram` or `push`) and `enabled`.
* `destinations`: changes to the workspace's Slack, Discord and Telegram channels, each with its `id` and the fields to change: `events`, `active`, `name`, `approve_buttons`, `account_ids`, `workspace_ids`, or for Slack `channel_id`. Fields you leave out stay as they are.

It is all or nothing. Every change is checked before any is saved, and an error names the one that failed, like `destinations.0.events`. The answer is the settings after the change, as [Get notification settings](https://docs.postsyncer.com/api-reference/notifications/get-settings.md) gives them.

Webhook endpoints are refused here: change them with [Update a webhook](https://docs.postsyncer.com/api-reference/webhooks/update.md).

## Errors

| Status | When | Retry? |
| - | - | - |
| 401 | No API key, or not a valid one. | No: fix the key. |
| 403 | The key lacks `notifications:update`, its user is inactive, or a channel change needs a role you don't have. | No. |
| 422 | A change didn't pass: a box that always stays on, an event a channel can't get, a destination of another workspace or a webhook endpoint. Nothing was saved. | No: fix that change. |
| 429 | More than 60 requests a minute. | Yes, after `Retry-After` seconds. |


## OpenAPI

````yaml PUT /notification-settings
openapi: 3.0.3
info:
  title: PostSyncer API
  description: >-
    Post to 12 social networks from your code: posts, media, comments,
    analytics, webhooks and more.
  version: 1.0.0
servers:
  - url: https://postsyncer.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: The workspaces the key can reach.
  - name: Accounts
    description: Connected social accounts, links to connect more, and disconnecting them.
  - name: Posts
    description: Drafts, scheduled and published posts, approvals and a post's history.
  - name: Post settings
    description: A post's auto-plug, comment moderation and contact collection.
  - name: Media
    description: >-
      The media library: file uploads, URL imports, and reading videos and
      social posts' files.
  - name: Folders
    description: Folders that organise the media library.
  - name: Comments
    description: >-
      Comments on your posts: reading, replying, editing, hiding, deleting and
      syncing them.
  - name: Reviews
    description: Google Business Profile reviews and your replies to them.
  - name: Analytics
    description: Workspace, account and post performance.
  - name: Brand
    description: >-
      A workspace's brand: identity, voice, look, accounts, competitors,
      learnings and rules.
  - name: Labels
    description: Labels used to tag posts.
  - name: Campaigns
    description: Campaigns used to group posts.
  - name: Snippets
    description: Saved snippets and hashtag groups to drop into posts.
  - name: Webhooks
    description: Signed webhook endpoints that get your notification events.
  - name: Billing
    description: >-
      The owner's plan, invoices and the links that pay for, change or cancel
      it.
  - name: Team
    description: A workspace's teammates and invitations, and their roles.
  - name: Notifications
    description: >-
      Your bell and notification settings, and the workspace's Slack, Discord
      and Telegram channels.
  - name: Blog-to-social
    description: Blog feeds that turn a workspace's new articles into posts.
  - name: Products
    description: Products the workspace's posts can promote.
  - name: Contacts
    description: People who commented on the workspace's posts, and the lists they are on.
  - name: Profile
    description: 'The key''s user: their name and sign-in email.'
  - name: API keys
    description: 'Your API keys: listing and deleting them.'
  - name: Agent sign-up
    description: >-
      An AI agent signs a person up with a code emailed to them, and gets their
      first key. No key needed.
paths:
  /notification-settings:
    put:
      tags:
        - Notifications
      summary: Update notification settings
      description: >-
        Needs `notifications:update`. Sets your own boxes (`preferences`) and
        changes the workspace's Slack, Discord and Telegram channels
        (`destinations`), in one go. Anyone in the workspace can set their own
        boxes; changing a channel needs a role that can manage notifications
        (owners and managers). All or nothing: every change is checked before
        any is saved, and an error names the one that failed
        (`destinations.0.events`). Answers with the settings, as Get
        notification settings does.
      operationId: updateNotificationSettings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspace_id
              properties:
                workspace_id:
                  type: integer
                  description: The workspace. It must be one the key can reach.
                preferences:
                  type: array
                  maxItems: 200
                  description: Your own boxes to set.
                  items:
                    type: object
                    required:
                      - event
                      - channel
                      - enabled
                    properties:
                      event:
                        type: string
                        description: An event from `preferences`.
                      channel:
                        type: string
                        enum:
                          - in_app
                          - email
                          - telegram
                          - push
                      enabled:
                        type: boolean
                destinations:
                  type: array
                  maxItems: 50
                  description: >-
                    Changes to the workspace's Slack, Discord and Telegram
                    channels. Only the fields you send change.
                  items:
                    type: object
                    required:
                      - id
                    properties:
                      id:
                        type: integer
                        description: A destination id from `destinations`.
                      events:
                        type: array
                        minItems: 1
                        items:
                          type: string
                        description: >-
                          The events it gets from now on: any of
                          `team_chat_events`.
                      active:
                        type: boolean
                        description: False pauses it.
                      name:
                        type: string
                        maxLength: 100
                      approve_buttons:
                        type: boolean
                      account_ids:
                        type: array
                        nullable: true
                        items:
                          type: integer
                        description: >-
                          Only events about these accounts; null or empty for
                          every account.
                      workspace_ids:
                        type: array
                        nullable: true
                        items:
                          oneOf:
                            - type: integer
                            - type: string
                              enum:
                                - '*'
                        description: >-
                          Other workspaces whose events it also gets, or `["*"]`
                          for every workspace you own.
                      channel_id:
                        type: string
                        description: >-
                          Slack only: move it to another channel of the same
                          Slack.
            examples:
              default:
                summary: Turn off an email and change a channel
                value:
                  workspace_id: 12
                  preferences:
                    - event: approval.requested
                      channel: email
                      enabled: false
                  destinations:
                    - id: 52
                      events:
                        - post.failed
                        - approval.requested
              pause:
                summary: Pause a channel
                value:
                  workspace_id: 12
                  destinations:
                    - id: 53
                      active: false
      responses:
        '200':
          description: Your settings, after the change.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotificationSettings'
              examples:
                default:
                  summary: Halden Coffee's settings
                  value:
                    workspace_id: 12
                    preferences:
                      - event: post.failed
                        label: Post failed
                        description: No account went live.
                        group: Posts
                        scope: workspace
                        needs_action: true
                        in_app:
                          enabled: true
                          locked: true
                        email:
                          enabled: true
                          available: true
                        telegram:
                          enabled: false
                          available: false
                        push:
                          enabled: false
                          available: false
                      - event: approval.requested
                        label: Approval requested
                        description: A post was sent for review.
                        group: Approvals
                        scope: workspace
                        needs_action: true
                        in_app:
                          enabled: true
                          locked: false
                        email:
                          enabled: true
                          available: true
                        telegram:
                          enabled: false
                          available: false
                        push:
                          enabled: true
                          available: true
                    destinations:
                      - id: 51
                        workspace_id: 12
                        kind: slack
                        name: '#launches'
                        channel:
                          id: C07LAUNCH
                          name: launches
                          is_private: false
                        team_name: Halden Coffee
                        approve_buttons: true
                        events:
                          - post.failed
                          - approval.requested
                        account_ids: null
                        workspace_ids: null
                        active: true
                        failing_since: null
                        disabled_reason: null
                        created_at: '2030-03-01T10:00:00+00:00'
                        updated_at: '2030-03-01T10:00:00+00:00'
                        stats_7d:
                          sent: 3
                          failed: 0
                          daily:
                            - date: '2030-03-09'
                              sent: 0
                              failed: 0
                            - date: '2030-03-10'
                              sent: 0
                              failed: 0
                            - date: '2030-03-11'
                              sent: 0
                              failed: 0
                            - date: '2030-03-12'
                              sent: 0
                              failed: 0
                            - date: '2030-03-13'
                              sent: 0
                              failed: 0
                            - date: '2030-03-14'
                              sent: 0
                              failed: 0
                            - date: '2030-03-15'
                              sent: 3
                              failed: 0
                        last_delivery_at: '2030-03-15T09:00:02+00:00'
                      - id: 52
                        workspace_id: 12
                        kind: discord
                        name: Discord channel
                        approve_buttons: true
                        events:
                          - post.failed
                        account_ids: null
                        workspace_ids: null
                        active: true
                        failing_since: null
                        disabled_reason: null
                        created_at: '2030-03-02T11:30:00+00:00'
                        updated_at: '2030-03-02T11:30:00+00:00'
                        stats_7d:
                          sent: 1
                          failed: 0
                          daily:
                            - date: '2030-03-09'
                              sent: 0
                              failed: 0
                            - date: '2030-03-10'
                              sent: 0
                              failed: 0
                            - date: '2030-03-11'
                              sent: 0
                              failed: 0
                            - date: '2030-03-12'
                              sent: 0
                              failed: 0
                            - date: '2030-03-13'
                              sent: 0
                              failed: 0
                            - date: '2030-03-14'
                              sent: 0
                              failed: 0
                            - date: '2030-03-15'
                              sent: 1
                              failed: 0
                        last_delivery_at: '2030-03-15T09:00:02+00:00'
                      - id: 53
                        workspace_id: 12
                        kind: telegram
                        name: Halden Coffee team
                        chat:
                          id: '-1002233445566'
                          title: Halden Coffee team
                          type: supergroup
                        approve_buttons: true
                        events:
                          - post.failed
                          - approval.requested
                        account_ids: null
                        workspace_ids: null
                        active: true
                        failing_since: null
                        disabled_reason: null
                        created_at: '2030-03-03T08:15:00+00:00'
                        updated_at: '2030-03-03T08:15:00+00:00'
                        stats_7d:
                          sent: 3
                          failed: 0
                          daily:
                            - date: '2030-03-09'
                              sent: 0
                              failed: 0
                            - date: '2030-03-10'
                              sent: 0
                              failed: 0
                            - date: '2030-03-11'
                              sent: 0
                              failed: 0
                            - date: '2030-03-12'
                              sent: 0
                              failed: 0
                            - date: '2030-03-13'
                              sent: 0
                              failed: 0
                            - date: '2030-03-14'
                              sent: 0
                              failed: 0
                            - date: '2030-03-15'
                              sent: 3
                              failed: 0
                        last_delivery_at: '2030-03-15T09:00:02+00:00'
                    slack_installations:
                      - id: 7
                        team_id: T01HALDEN
                        team_name: Halden Coffee
                    team_chat_events:
                      - key: post.failed
                        label: Post failed
                        description: No account went live.
                        group: Posts
                        needs_action: true
                        team_default: 'on'
                      - key: approval.requested
                        label: Approval requested
                        description: A post was sent for review.
                        group: Approvals
                        needs_action: true
                        team_default: 'on'
                      - key: account.disconnected
                        label: Account disconnected
                        description: An account was removed.
                        group: Accounts
                        needs_action: false
                        team_default: 'off'
        '401':
          $ref: '#/components/responses/Unauthorized401'
        '403':
          description: >-
            The key lacks `notifications:update`, or its user is inactive, or
            your role can't manage notifications in the workspace, or the
            destination sends events from workspaces you can't manage. Your own
            boxes need no role.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_permission:
                  summary: The key lacks notifications:update
                  value:
                    message: >-
                      This API key does not have the "notifications:update"
                      permission. Edit the key in PostSyncer under Settings →
                      API to grant it.
                role:
                  summary: The role can't manage notifications
                  value:
                    message: >-
                      Your role in the workspace "Halden Coffee" does not allow
                      you to edit notifications. Ask the workspace owner or a
                      manager to do it, or to change your role.
                scope:
                  summary: It sends events from workspaces you can't manage
                  value:
                    message: >-
                      This destination also sends events from workspaces you
                      can’t manage. Ask the person who set it up to change it.
                inactive_account:
                  summary: The key's user is inactive
                  value:
                    message: Your account is inactive.
        '422':
          description: A change didn't pass, and nothing was saved.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ValidationError'
                  - $ref: '#/components/schemas/Error'
              examples:
                locked:
                  summary: A box that always stays on
                  value:
                    message: This alert stays on in the app.
                events:
                  summary: An event a channel can't get
                  value:
                    message: >-
                      This destination cannot get these events:
                      billing.payment_failed.
                    errors:
                      destinations.0.events:
                        - >-
                          This destination cannot get these events:
                          billing.payment_failed.
                not_here:
                  summary: A destination of another workspace
                  value:
                    message: This destination is not in this workspace.
                    errors:
                      destinations.0.id:
                        - This destination is not in this workspace.
                webhook:
                  summary: A webhook endpoint
                  value:
                    message: >-
                      This is for Slack, Discord and Telegram. For webhook
                      endpoints, use the webhook tools (the /webhooks routes in
                      the API).
                    errors:
                      destinations.0.id:
                        - >-
                          This is for Slack, Discord and Telegram. For webhook
                          endpoints, use the webhook tools (the /webhooks routes
                          in the API).
                empty:
                  summary: Nothing to change
                  value:
                    message: Send preferences, destinations or both.
                    errors:
                      preferences:
                        - Send preferences, destinations or both.
        '429':
          $ref: '#/components/responses/RateLimited429'
components:
  schemas:
    NotificationSettings:
      type: object
      description: Your notification settings in a workspace.
      required:
        - workspace_id
        - preferences
        - destinations
        - slack_installations
        - team_chat_events
      properties:
        workspace_id:
          type: integer
        preferences:
          type: array
          items:
            $ref: '#/components/schemas/NotificationPreference'
          description: Your own boxes, one row per event.
        destinations:
          type: array
          items:
            $ref: '#/components/schemas/NotificationDestination'
          description: >-
            The workspace's Slack, Discord and Telegram channels. Webhook
            endpoints are under [Webhooks](/api-reference/webhooks/list).
        slack_installations:
          type: array
          description: The Slack workspaces connected to this workspace.
          items:
            type: object
            required:
              - id
              - team_id
              - team_name
            properties:
              id:
                type: integer
                description: Use it with List Slack channels and Add a Slack channel.
              team_id:
                type: string
              team_name:
                type: string
                nullable: true
        team_chat_events:
          type: array
          description: The events a Slack, Discord or Telegram channel can get.
          items:
            type: object
            required:
              - key
              - label
              - description
              - group
              - needs_action
              - team_default
            properties:
              key:
                type: string
              label:
                type: string
              description:
                type: string
              group:
                type: string
              needs_action:
                type: boolean
              team_default:
                type: string
                enum:
                  - 'on'
                  - 'off'
                description: Whether a new channel gets it.
    Error:
      type: object
      description: >-
        An error answer. Every one has `message`, in plain words; some add an
        `error` code and fields of their own.
      required:
        - message
      properties:
        message:
          type: string
          description: What went wrong and what to do about it.
        error:
          type: string
          description: >-
            A code a few errors add, such as `rate_limited`. See [Handle
            errors](/essentials/error-handling#answers-with-an-error-code).
    ValidationError:
      type: object
      description: '422: the request didn''t pass validation, and nothing changed.'
      required:
        - message
        - errors
      properties:
        message:
          type: string
          description: >-
            The first error and, when there are more, how many: `(and 1 more
            error)`, `(and 2 more errors)`.
        errors:
          type: object
          description: >-
            The messages, by field. A field inside a list is named with dots:
            `accounts.0.id`.
          additionalProperties:
            type: array
            items:
              type: string
    NotificationPreference:
      type: object
      description: >-
        One event, and whether it reaches you in the app, by email, on Telegram
        and by push.
      required:
        - event
        - label
        - description
        - group
        - scope
        - needs_action
        - in_app
        - email
        - telegram
        - push
      properties:
        event:
          type: string
        label:
          type: string
        description:
          type: string
        group:
          type: string
        scope:
          type: string
          enum:
            - workspace
            - account
          description: >-
            `account` for an event that is the same in every workspace, like
            billing.
        needs_action:
          type: boolean
        in_app:
          type: object
          required:
            - enabled
            - locked
          properties:
            enabled:
              type: boolean
            locked:
              type: boolean
              description: True when it always stays on in the app.
        email:
          type: object
          required:
            - enabled
            - available
          properties:
            enabled:
              type: boolean
            available:
              type: boolean
              description: False when there is no email for it.
        telegram:
          type: object
          required:
            - enabled
            - available
          properties:
            enabled:
              type: boolean
            available:
              type: boolean
              description: False until you connect your own Telegram.
        push:
          type: object
          required:
            - enabled
            - available
          properties:
            enabled:
              type: boolean
            available:
              type: boolean
              description: False when there is no push for it.
    NotificationDestination:
      type: object
      description: >-
        A Slack, Discord or Telegram channel that gets the workspace's
        notifications. Its connection details are never shown.
      required:
        - id
        - workspace_id
        - kind
        - name
        - approve_buttons
        - events
        - account_ids
        - workspace_ids
        - active
        - failing_since
        - disabled_reason
        - created_at
        - updated_at
      properties:
        id:
          type: integer
        workspace_id:
          type: integer
          description: The workspace it belongs to.
        kind:
          type: string
          enum:
            - slack
            - discord
            - telegram
        name:
          type: string
          maxLength: 100
        channel:
          type: object
          description: 'Slack only: the channel.'
          required:
            - id
            - name
            - is_private
          properties:
            id:
              type: string
            name:
              type: string
              nullable: true
            is_private:
              type: boolean
        chat:
          type: object
          description: 'Telegram only: the chat.'
          required:
            - id
            - title
            - type
          properties:
            id:
              type: string
            title:
              type: string
              nullable: true
            type:
              type: string
              nullable: true
              description: '`private`, `group`, `supergroup` or `channel`.'
        team_name:
          type: string
          nullable: true
          description: 'Slack only: the Slack workspace.'
        approve_buttons:
          type: boolean
          description: Whether approval requests carry Approve and Reject buttons.
        events:
          type: array
          items:
            type: string
          description: 'The events it gets: any of `team_chat_events`.'
        account_ids:
          type: array
          nullable: true
          items:
            type: integer
          description: Only events about these accounts; null for every account.
        workspace_ids:
          type: array
          nullable: true
          items:
            oneOf:
              - type: integer
              - type: string
                enum:
                  - '*'
          description: >-
            The other workspaces it gets events from, or `["*"]` for every
            workspace the owner has; null for its own workspace alone.
        active:
          type: boolean
          description: 'False when it is paused: nothing is sent to it.'
        failing_since:
          type: string
          format: date-time
          nullable: true
          description: When its deliveries started failing; null while they work.
        disabled_reason:
          type: string
          nullable: true
          description: Why PostSyncer turned it off; null otherwise.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        stats_7d:
          type: object
          description: >-
            Deliveries over the last 7 days: today and the six days before,
            oldest first.
          required:
            - sent
            - failed
            - daily
          properties:
            sent:
              type: integer
            failed:
              type: integer
            daily:
              type: array
              items:
                type: object
                required:
                  - date
                  - sent
                  - failed
                properties:
                  date:
                    type: string
                    format: date
                  sent:
                    type: integer
                  failed:
                    type: integer
        last_delivery_at:
          type: string
          format: date-time
          nullable: true
          description: When the latest delivery was made; null before the first.
  responses:
    Unauthorized401:
      description: No API key, or not a valid one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthenticated:
              summary: No valid API key
              value:
                message: Unauthenticated.
    RateLimited429:
      description: >-
        More than 60 requests in a minute from this key's user (the API and the
        MCP server share the count). Wait `Retry-After` seconds.
      headers:
        Retry-After:
          description: Seconds until requests are allowed again.
          schema:
            type: integer
        X-RateLimit-Limit:
          description: Requests allowed a minute.
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Requests left this minute.
          schema:
            type: integer
        X-RateLimit-Reset:
          description: When requests are allowed again, as a Unix timestamp.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            too_many_attempts:
              summary: Too many requests
              value:
                message: Too Many Attempts.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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