> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-restapi-chatapi-eng-38785.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Unpin a pinned CometChat message with REST API. Any user with unpin permission can unpin, not only the user who pinned it.

# Unpin Message

For the complete error reference, see [Error Guide](/articles/error-guide).


## OpenAPI

````yaml delete /messages/{id}/pin
openapi: 3.0.0
info:
  title: Chat APIs
  description: Manage messages, users, groups for a particular app using our Chat API.
  version: '3.0'
servers:
  - url: https://{appId}.api-{region}.cometchat.io/v3
    variables:
      appId:
        default: appId
        description: (Required) App ID
      region:
        enum:
          - us
          - eu
          - in
        default: us
        description: Select Region
security: []
tags:
  - name: API Keys
    description: The API keys are used to authorise the APIs
  - name: Roles
    description: The roles are used to give user access rights
  - name: Users
    description: The REST collection for users.
  - name: Auth Tokens
    description: The auth tokens are used to login end users using client SDKs.
  - name: Blocked Users
    description: The REST collections for blocked users.
  - name: Friends
    description: List,add and remove friends by passing UID in path variables
  - name: Groups
    description: The REST collections for groups.
  - name: Banned Users
    description: Ban and Unban user by passing other UID in path variables.
  - name: Group Members
    description: The REST collections for group members.
  - name: Messages
    description: The REST collections for messages.
  - name: Conversations
    description: The REST collections for conversations.
  - name: Restrict Features
    description: Allows Restricting Features
  - name: Metrics
    description: Allows accessing Data Metrics
  - name: Triggers
    description: Allows adding triggers to a webhook.
  - name: Webhooks
    description: Allows accessing Webhooks.
  - name: Notifications
    description: Allows configuring Notifications core.
  - name: Moderation
    description: The REST collections for Moderations.
paths:
  /messages/{id}/pin:
    delete:
      tags:
        - Messages
      summary: Unpin Message
      description: >-
        Unpins a message. Anyone with unpin permission may unpin, not only the
        user who pinned it. Idempotent.
      operationId: unpin-message
      parameters:
        - name: onBehalfOf
          in: header
          description: >-
            UID of the user to unpin the message as. Leave it out to unpin as
            the app itself.
          required: false
          schema:
            type: string
        - name: id
          in: path
          description: Id of the message to unpin.
          required: true
          schema:
            type: string
          examples:
            string:
              summary: Message ID
              value: ''
      responses:
        '200':
          description: >-
            Unpinning a message. pinnedBy and pinnedAt are left out of the
            response once the message is no longer pinned.
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/messageSchema'
                type: object
              example:
                data:
                  id: '2'
                  conversationId: superhero1_user_superhero2
                  sender: superhero1
                  receiverType: user
                  receiver: superhero2
                  category: message
                  type: text
                  data:
                    text: Hi,
                  sentAt: 1700210266
                  updatedAt: 1700210266
        '404':
          description: No message with that id
          content:
            application/json:
              schema:
                type: object
              example:
                error:
                  code: ERR_MESSAGE_ID_NOT_FOUND
                  message: Message with the provided info doesn't exist.
      security:
        - apiKey: []
components:
  schemas:
    messageSchema:
      description: Response data
      properties:
        id:
          type: string
        conversationId:
          type: string
        sender:
          type: string
        receiverType:
          type: string
        receiver:
          type: string
        category:
          type: string
        type:
          type: string
        data:
          properties:
            text:
              type: string
            metadata:
              type: object
            entities:
              properties:
                sender:
                  properties:
                    entity:
                      properties:
                        uid:
                          type: string
                        name:
                          type: string
                        role:
                          type: string
                        avatar:
                          type: string
                        status:
                          type: string
                        createdAt:
                          type: integer
                        conversationId:
                          type: string
                      type: object
                    entityType:
                      type: string
                  type: object
                receiver:
                  properties:
                    entity:
                      properties:
                        uid:
                          type: string
                        name:
                          type: string
                        role:
                          type: string
                        avatar:
                          type: string
                        status:
                          type: string
                        createdAt:
                          type: integer
                        conversationId:
                          type: string
                      type: object
                    entityType:
                      type: string
                  type: object
              type: object
          type: object
        sentAt:
          type: integer
        updatedAt:
          type: integer
        pinnedBy:
          description: >-
            UID of the user who pinned the message, or app_system when the app
            pinned it. Left out of the response when the message is not pinned.
          type: string
        pinnedAt:
          description: >-
            When the message was pinned, in seconds. Left out of the response
            when the message is not pinned.
          type: integer
        savedAt:
          description: >-
            When the message was saved, in seconds. Only present for the user
            who saved it, and left out of the response when they have not saved
            it.
          type: integer
      type: object
  securitySchemes:
    apiKey:
      type: apiKey
      description: API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
      name: apikey
      in: header

````