---
updatedAt: 2026-04-24T16:37:26.000Z
agentTools:
  projectIndex: https://developers.cloudbeds.com/llms.txt
---

# Update a rank

Update the rank of a favorite. If there is already a favorite in the new position, it will be
updated with the current rank, swapping the position

**Notes**
- There is not possible to have 2 ranks with the same value could not be duplicated.
- The maximum numbers of reports to favorite is 12.
- Example: If you want to update a favorite to the rank 1, being your favorite in the position 2. The rank in the
position 1 will be moved to the 2 and the 2 to the 1

# OpenAPI definition

```json
{
  "info": {
    "description": "#### The Cloudbeds Data Insights API provides programmatic methods to access report data in [Data Insights](https://www.cloudbeds.com/measure-success/). With the Cloudbeds Data Insights API, you can:\n\n- Build custom reports to display Cloudbeds data.\n- Automate complex reporting tasks to save time.\n- Integrate your Cloudbeds data with other business applications.\n- Schedule your reports to your email in a custom frequency\n- Access stock/custom reports created by Cloudbeds\n- And many others\n- Export Request has a limit of 100000 records\n- Data and Summary requests has a limit of 100 records when the mode is Preview\n- Data and Summary requests has a limit of 12000 records when the mode is Run\n\n*Note: The API return application/json*.",
    "version": "1.1",
    "title": "Data Insights API",
    "termsOfService": "https://www.cloudbeds.com/terms/api/",
    "contact": {
      "email": "support@cloudbeds.com"
    },
    "license": {
      "name": "Cloudbeds",
      "url": "https://www.cloudbeds.com/"
    }
  },
  "components": {
    "securitySchemes": {
      "Authorization": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "##### Authorization refers to the process of granting a user or application access permissions to Cloudbeds data and features.\n\nTo authenticate your users, your App will need to implement an [authorization code flow](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1).\n[Cloudbeds API Authentication](https://hotels.cloudbeds.com/api/docs/#api-Authentication) lets you direct your users to an authorization dialog on Cloudbeds.\nFrom there, the primary Cloudbeds experience will show the authorization dialog and handle the authorization on behalf of your App.\nYour users will be able to authorize or decline.\nAfter the user makes their choice, Cloudbeds will redirect the user to your App, where you can exchange the authorization code for an access token (if the user authorized your App), or handle a rejection (if the user did not authorize your App).\n\nIf using a cloudbeds API key, you can pass it as a header with the following format: `X-API-KEY: <your_api_key>`\n\n###### Cloudbeds implements the [OAuth 2.0](https://integrations.cloudbeds.com/hc/en-us/articles/360006450433-OAuth-2-0) authorization framework."
      }
    },
    "schemas": {
      "ErrorContent": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "Error code"
          },
          "status": {
            "type": "string",
            "description": "Error status"
          },
          "description": {
            "type": "string",
            "description": "Error description"
          },
          "message": {
            "type": "object",
            "description": "Error message"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorContent"
          }
        }
      },
      "Favorite": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "readOnly": true,
            "description": "Favorite Id",
            "example": 1
          },
          "rank": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "description": "Rank associated to the favorite in order to display the reports",
            "example": "1"
          },
          "report_id": {
            "type": "integer",
            "description": "Report, Stock Report or Hub Id favorited",
            "example": "1"
          },
          "entity_id": {
            "type": "integer",
            "description": "Report, Stock Report or Hub Id favorited",
            "example": "1"
          },
          "report_kind": {
            "type": "string",
            "enum": [
              "report",
              "stock_report",
              "hub"
            ],
            "description": "Report Kind",
            "example": "stock_report"
          },
          "kind": {
            "type": "string",
            "enum": [
              "report",
              "stock_report",
              "hub"
            ],
            "description": "Favorite Kind",
            "example": "stock_report"
          }
        },
        "required": [
          "id",
          "rank"
        ]
      },
      "Rank": {
        "type": "object",
        "properties": {
          "rank": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "description": "Rank associated to the favorite in order to display the reports",
            "example": "1"
          }
        },
        "required": [
          "rank"
        ]
      }
    }
  },
  "paths": {
    "/datainsights/v1.1/favorites/{id}": {
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Favorite Id of the resource",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "X-PROPERTY-ID",
            "required": true,
            "description": "Property id of the client",
            "schema": {
              "type": "integer",
              "writeOnly": true,
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Favorite"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Rank"
              }
            }
          }
        },
        "summary": "Update a rank",
        "description": "Update the rank of a favorite. If there is already a favorite in the new position, it will be\nupdated with the current rank, swapping the position\n\n**Notes**\n- There is not possible to have 2 ranks with the same value could not be duplicated.\n- The maximum numbers of reports to favorite is 12.\n- Example: If you want to update a favorite to the rank 1, being your favorite in the position 2. The rank in the\nposition 1 will be moved to the 2 and the 2 to the 1",
        "tags": [
          "Favorites"
        ],
        "security": [
          {
            "Authorization": []
          }
        ]
      },
      "parameters": [
        {
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 0
          }
        }
      ]
    }
  },
  "tags": [
    {
      "name": "Favorites",
      "description": "Operations on Favorites"
    }
  ],
  "openapi": "3.0.2",
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```