---
updatedAt: 2026-10-22T06:31:50.000Z
agentTools:
  projectIndex: https://developers.kaleyra.io/llms.txt
---

# Pin or Unpin Group Messages

The Pin or Unpin Group Messages feature allow group admins to highlight important messages in a WhatsApp group. Pinned messages remain easily accessible to all group participants, ensuring that important information stays visible.

## Key Features

The Pin and Unpin Group Messages API support the following key features:

* Only group admins can pin or unpin messages.
* A maximum of 3 messages can be pinned at any given time.
* If a new message is pinned when 3 messages are already pinned, the oldest pinned message is automatically unpinned.
* Each API request can pin or unpin only one message.
* Pinned messages are displayed in reverse chronological order, with the newest pinned message appearing first.

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "WhatsApp Group Messaging API",
    "version": "1.0.0",
    "description": "APIs for WhatsApp Group Messaging operations."
  },
  "servers": [
    {
      "url": "https://api.in.kaleyra.io",
      "description": "India Pod"
    },
    {
      "url": "https://api.ap.kaleyra.io",
      "description": "Singapore Pod"
    },
    {
      "url": "https://api.eu.kaleyra.io",
      "description": "EU Pod"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "WhatsApp Group Messaging"
    }
  ],
  "paths": {
    "/v2/{sid}/whatsapp/{phone_number}/pin-unpin-messages": {
      "post": {
        "tags": [
          "WhatsApp Group Messaging"
        ],
        "summary": "Pin or Unpin Group Messages",
        "parameters": [
          {
            "$ref": "#/components/parameters/SID"
          },
          {
            "$ref": "#/components/parameters/PhoneNumber"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PinUnpinMessageRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/Accepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "x-internal": false
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "name": "api-key",
        "in": "header"
      }
    },
    "parameters": {
      "SID": {
        "name": "sid",
        "in": "path",
        "required": true,
        "description": "Unique identifier of the Kaleyra account.",
        "schema": {
          "type": "string"
        },
        "example": "HXAP1XXXXXXXX"
      },
      "PhoneNumber": {
        "name": "phone_number",
        "in": "path",
        "required": true,
        "description": "WhatsApp Business phone number associated with the account.",
        "schema": {
          "type": "string"
        },
        "example": "91XXXXXXXXXX"
      }
    },
    "schemas": {
      "ExtraInfo": {
        "type": "object",
        "properties": {
          "ref": {
            "type": "string",
            "description": "Primary reference identifier used to identify the entity.",
            "example": "customer1"
          },
          "ref1": {
            "type": "string",
            "description": "Secondary reference value, typically used to store a category, source, or business segment.",
            "example": "marketing"
          },
          "ref2": {
            "type": "string",
            "description": "Additional reference value used for classification purposes.",
            "example": "dictionary"
          },
          "wa_source": {
            "type": "string",
            "description": "Source identifier indicating the origin of the WhatsApp interaction or campaign.",
            "example": "whatsapp"
          }
        }
      },
      "PinUnpinMessageRequest": {
        "type": "object",
        "required": [
          "messaging_object"
        ],
        "properties": {
          "messaging_object": {
            "type": "object",
            "required": [
              "messaging_product",
              "recipient_type",
              "to",
              "type",
              "pin"
            ],
            "properties": {
              "messaging_product": {
                "type": "string",
                "enum": [
                  "whatsapp"
                ]
              },
              "recipient_type": {
                "type": "string",
                "enum": [
                  "group"
                ]
              },
              "to": {
                "type": "string",
                "description": "WhatsApp Group ID"
              },
              "type": {
                "type": "string",
                "enum": [
                  "pin",
                  "unpin"
                ]
              },
              "pin": {
                "$ref": "#/components/schemas/PinOperation"
              },
              "extra_info": {
                "$ref": "#/components/schemas/ExtraInfo"
              }
            }
          }
        }
      },
      "PinOperation": {
        "type": "object",
        "required": [
          "type",
          "message_id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "pin",
              "unpin"
            ]
          },
          "message_id": {
            "type": "string"
          },
          "expiration_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30,
            "description": "Required only when type is pin."
          }
        }
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "example": "WA202"
          },
          "message": {
            "type": "string",
            "example": "Request Accepted"
          },
          "data": {
            "type": "object",
            "properties": {
              "message_id": {
                "type": "string"
              }
            }
          },
          "error": {
            "type": "object"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "data": {
            "nullable": true
          },
          "error": {
            "type": "object"
          }
        }
      }
    },
    "responses": {
      "Accepted": {
        "description": "Request Accepted",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SuccessResponse"
            },
            "example": {
              "code": "WA202",
              "message": "Request Accepted",
              "data": {
                "message_id": "ACOJKFOADFIOJIJ5325C"
              },
              "error": {}
            }
          }
        }
      },
      "BadRequest": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "IncorrectPayload": {
                "summary": "Incorrect Payload",
                "value": {
                  "code": "WA400",
                  "message": "Refer to correct payload format",
                  "data": {},
                  "error": {
                    "payload": "Incorrect payload format"
                  }
                }
              },
              "LowBalance": {
                "summary": "Low Balance",
                "value": {
                  "code": "E110",
                  "message": "Please check your balance, You have a low balance!",
                  "data": {},
                  "error": {
                    "balance": "Please check your balance, You have a low balance!"
                  }
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "InvalidCredentials": {
                "summary": "Incorrect SID or API Key",
                "value": {
                  "code": "RBC001",
                  "message": "Incorrect SID or API key.",
                  "data": {},
                  "error": {
                    "body": "Incorrect SID or API key.",
                    "error": "record not found"
                  }
                }
              },
              "InvalidPhoneNumber": {
                "summary": "Phone number is not present or does not belong to the account",
                "value": {
                  "code": "WA401",
                  "message": "Phone number is not present or does not belong to the account.",
                  "data": {},
                  "error": {
                    "phone_number": "Phone number is not present or does not belong to the account."
                  }
                }
              },
              "InvalidPhoneNumberVersion": {
                "summary": "Wrong WhatsApp API version",
                "value": {
                  "code": "WA401",
                  "message": "The phone number you're using is associated with different Version of our WA API. Please use the appropriate endpoint.",
                  "data": {},
                  "error": {
                    "phone_number": "The phone number you're using is associated with different Version of our WA API. Please use the appropriate endpoint."
                  }
                }
              }
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal Server Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "code": "WA500",
              "message": "Please try again later",
              "data": {},
              "error": {
                "error": "Internal server error"
              }
            }
          }
        }
      }
    }
  }
}
```