---
title: Change Sale state
slug: change-sale-state
docTags: 
createdAt: 2026-04-21T15:22:49.957Z
---

{
  "id": "pzW_IhSCpbtVP67ei8985",
  "type": "api-oas-v2",
  "data": {
    "method": "PUT",
    "url": "https://developer.digitail.io/api/v1/sale/{id}/change-edit-state",
    "servers": [
      {
        "url": "https://developer.digitail.io/api/v1/sale/{id}/change-edit-state",
        "description": "Sandbox server (uses test data)"
      },
      {
        "url": "https://vet.digitail.io/api/v1/sale/{id}/change-edit-state",
        "description": "Production server (uses live data)"
      }
    ],
    "name": "Change Sale state",
    "description": "<p>Permissions needed: any of (CREATE_CHECKUPS, EDIT_CHECKUPS, CREATE_EDIT_COUNTER_SALE, SELL_SERVICES); sometimes REOPEN_SALE\nChange just the Sale's edit state</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "schema": [
            {
              "name": "edit_state",
              "kind": "optional",
              "type": "integer",
              "description": "<p>1 - Open \n 2 - Ready For Checkout \n 3 - Closed</p>",
              "enum": [
                "1",
                "2",
                "3"
              ]
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "passport",
          "name": "passport",
          "kind": "optional",
          "type": "oauth2",
          "description": "Laravel passport oauth2 security.",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://digitail.test/oauth/authorize",
              "tokenUrl": "https://digitail.test/oauth/token",
              "refreshUrl": "https://digitail.test/oauth/token"
            }
          }
        },
        {
          "id": "Bearer",
          "name": "Bearer",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "successful operation",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "data",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": [
                  {
                    "name": "edit_state_details",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "example": "",
                    "schema": [
                      {
                        "name": "state",
                        "kind": "optional",
                        "type": "integer",
                        "description": "<p><code>1</code> - Open <code>2</code> - Ready For Checkout <code>3</code> - Closed</p>",
                        "enum": [
                          "1",
                          "2",
                          "3"
                        ]
                      },
                      {
                        "name": "label",
                        "kind": "optional",
                        "type": "string",
                        "description": "Label of the current state\n"
                      },
                      {
                        "name": "can_transit_to",
                        "kind": "optional",
                        "type": "array",
                        "description": "",
                        "example": "",
                        "itemType": "object",
                        "customType": "object[]",
                        "schema": [
                          {
                            "name": "label",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "labels.sale_edit_state.states.open"
                          },
                          {
                            "name": "action",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "example": "labels.sale_edit_state.actions.open"
                          },
                          {
                            "name": "state",
                            "kind": "optional",
                            "type": "integer",
                            "description": "",
                            "example": 1,
                            "enum": [
                              "1",
                              "2",
                              "3"
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "Bad request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "undefined",
            "example": "{\"message\":\"The given data was invalid.\",\"errors\":{\"edit_state\":[\"This value is invalid\"]}}",
            "description": "",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "Ahf-H1tL7LZeNQuvdc4d4",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PUT \\\n     --url https://developer.digitail.io/api/v1/sale/{id}/change-edit-state \\\n     --header 'accept: application/json'"
        },
        {
          "id": "JgUrcjMRrtIJ67gClzcvH",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'PUT',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://developer.digitail.io/api/v1/sale/{id}/change-edit-state\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ga9flhvJYkGl7RVbqXL01",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://developer.digitail.io/api/v1/sale/{id}/change-edit-state\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "TDxeBdcvT5_XY6L-wFOmu",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://developer.digitail.io/api/v1/sale/{id}/change-edit-state\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"PUT\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "Ahf-H1tL7LZeNQuvdc4d4"
    },
    "results": {
      "languages": [
        {
          "id": "4wQCOxcO_QXof_toSsxNY",
          "language": "200",
          "code": "// successful operation\n{\n  \"data\": {\n    \"edit_state_details\": {\n      \"state\": 0,\n      \"label\": \"\",\n      \"can_transit_to\": [\n        {\n          \"label\": \"labels.sale_edit_state.states.open\",\n          \"action\": \"labels.sale_edit_state.actions.open\",\n          \"state\": 1\n        }\n      ]\n    }\n  }\n}"
        },
        {
          "id": "-WVcZGtRdaCp40VjIVXJ1",
          "language": "422",
          "code": "// Bad request\n\"{\\\"message\\\":\\\"The given data was invalid.\\\",\\\"errors\\\":{\\\"edit_state\\\":[\\\"This value is invalid\\\"]}}\""
        }
      ],
      "selectedLanguageId": "4wQCOxcO_QXof_toSsxNY"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}