---
agentTools:
  projectIndex: https://gigasheet.readme.io/llms.txt
---

# Set sort model

Set sort model in the client state of a sheet.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "description": "Gigasheet - The Big Data Cloud Spreadsheet",
    "title": "Gigasheet API",
    "termsOfService": "https://gigasheet.com/terms-of-use",
    "contact": {
      "name": "Gigasheet Support",
      "url": "https://gigasheet.freshdesk.com/support/home",
      "email": "support@gigasheet.com"
    },
    "version": "1.0"
  },
  "paths": {
    "/client-state/{handle}/sort-model": {
      "put": {
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "description": "Set sort model in the client state of a sheet.",
        "tags": [
          "file"
        ],
        "summary": "Set sort model",
        "parameters": [
          {
            "description": "Handle of sheet to update",
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/clientstate.SetSortModelRequest"
              }
            }
          },
          "description": "sort model",
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "//api.gigasheet.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "description": "API key authentication for Gigasheet, contact support@gigasheet.com for instructions",
        "type": "apiKey",
        "name": "X-GIGASHEET-TOKEN",
        "in": "header"
      }
    },
    "schemas": {
      "clientstate.SetSortModelRequest": {
        "type": "object",
        "properties": {
          "sortModel": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/clientstate.SortModel"
            }
          }
        }
      },
      "clientstate.SortModel": {
        "type": "object",
        "properties": {
          "colId": {
            "type": "string"
          },
          "pivotFieldGroupId": {
            "description": "if pivot mode is enabled it can be sorted by pivot field group id (the column headers in pivot mode)",
            "type": "string"
          },
          "sort": {
            "type": "string"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 99,
      "1": 106,
      "2": 153,
      "3": 247,
      "4": 195,
      "5": 218,
      "6": 27,
      "7": 0,
      "8": 15,
      "9": 88,
      "10": 245,
      "11": 236
    }
  }
}
```