---
title: Set Legal Hold on a Customer
slug: api-documentation/set-legal-hold-on-a-customer
docTags: 
createdAt: 2026-08-27T17:03:03.147Z
---

{
  "id": "djAtbrKF0bv3hIDN36U9d",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.upstartcommerce.com/v1/customer/legal-hold",
    "servers": [
      {
        "url": "https://api.upstartcommerce.com/v1/customer/legal-hold"
      }
    ],
    "name": "Set Legal Hold on a Customer",
    "description": "<p>Places a legal hold on the specified customer. While a legal hold is active,\nthe customer is excluded from data retention deletion.</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"
        },
        {
          "kind": "required",
          "name": "x-upstart-tenant",
          "type": "string",
          "description": "Tenant identifier associated with the site."
        },
        {
          "kind": "required",
          "name": "x-upstart-site",
          "type": "string",
          "description": "The site identifier."
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Request body for placing a legal hold on a customer.",
          "customType": "LegalHoldRequest",
          "schema": [
            {
              "name": "customerId",
              "kind": "required",
              "type": "string<uuid>",
              "description": "",
              "format": "uuid"
            },
            {
              "name": "holdReason",
              "kind": "required",
              "type": "string",
              "description": "Reason for placing the legal hold."
            }
          ],
          "modelRef": "#/components/schemas/LegalHoldRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "ApiKeyAccess",
          "name": "X-Upstart-Api-Key",
          "kind": "optional",
          "type": "apiKey",
          "description": "Api key based authorization.",
          "in": "header"
        },
        {
          "id": "SessionIdAccess",
          "name": "X-Upstart-Session-Id",
          "kind": "optional",
          "type": "apiKey",
          "description": "Session based authorization. This authentication is required for clients to interact with any of the management APIs.",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Legal hold set successfully.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Active legal hold details for a customer.",
            "customType": "LegalHoldResponse",
            "schema": [
              {
                "name": "tenant",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "siteId",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "customerId",
                "kind": "required",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              },
              {
                "name": "holdReason",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "createdAt",
                "kind": "required",
                "type": "string<date-time>",
                "description": "",
                "format": "date-time"
              }
            ],
            "modelRef": "#/components/schemas/LegalHoldResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "The request contained information that the server was unable to process. Appropriate errors are provided in the response body.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "array",
            "description": "Error response for validation errors.",
            "customType": "ValidationErrorResponse[]",
            "schema": [
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "detail",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "reason",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "modelRef": "#/components/schemas/ValidationErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "The provided credentials were not valid for this endpoint.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "UnauthorizedErrorResponse",
            "schema": [
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "detail",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "reason",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "modelRef": "#/components/schemas/UnauthorizedErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "User's roles are insufficient for this endpoint.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "detail",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "reason",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "The requested resource was not found.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "detail",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "reason",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "409",
        "description": "<p>The request conflicts with the current state of the resource (e.g., the customer is already under legal hold).</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "detail",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "reason",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "500",
        "description": "There was an internal server error.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "detail",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "reason",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "8jy2_NVmgxMvLZJtsot4h",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.upstartcommerce.com/v1/customer/legal-hold \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-upstart-tenant: string' \\\n     --header 'x-upstart-site: string' \\\n     --data '{\n     \"customerId\": \"\",\n     \"holdReason\": \"\"\n     }'"
        },
        {
          "id": "kpDE6rrq1lEQSldf_Dxs1",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-upstart-tenant\", \"string\");\nmyHeaders.append(\"x-upstart-site\", \"string\");\n\nvar raw = JSON.stringify({\n   \"customerId\": \"\",\n   \"holdReason\": \"\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.upstartcommerce.com/v1/customer/legal-hold\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "t38udIQJqeZgj5OnFdZwu",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.upstartcommerce.com/v1/customer/legal-hold\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-upstart-tenant\"] = \"string\"\nrequest[\"x-upstart-site\"] = \"string\"\nrequest.body = JSON.dump({\n   \"customerId\": \"\",\n   \"holdReason\": \"\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "Qss_Ho1VngQ3kTd96ZDYr",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.upstartcommerce.com/v1/customer/legal-hold\"\n\npayload = json.dumps({\n   \"customerId\": \"\",\n   \"holdReason\": \"\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-upstart-tenant': 'string',\n   'x-upstart-site': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "8jy2_NVmgxMvLZJtsot4h"
    },
    "results": {
      "languages": [
        {
          "id": "bXhVqkmpd3lflPQYHlQ49",
          "language": "200",
          "code": "// Legal hold set successfully.\n{\n  \"tenant\": \"\",\n  \"siteId\": \"\",\n  \"customerId\": \"\",\n  \"holdReason\": \"\",\n  \"createdAt\": \"\"\n}"
        },
        {
          "id": "XtaHqB5RfWFqiN5RDVE9G",
          "language": "400",
          "code": "// The request contained information that the server was unable to process. Appropriate errors are provided in the response body.\n[\n  {\n    \"name\": \"\",\n    \"code\": \"\",\n    \"detail\": \"\",\n    \"reason\": \"\"\n  }\n]"
        },
        {
          "id": "57hVpKHr1VZC0B41EE-KQ",
          "language": "401",
          "code": "// The provided credentials were not valid for this endpoint.\n{\n  \"name\": \"\",\n  \"code\": \"\",\n  \"detail\": \"\",\n  \"reason\": \"\"\n}"
        },
        {
          "id": "ESZN5lYPfhGE58DjdgyA5",
          "language": "403",
          "code": "// User's roles are insufficient for this endpoint.\n{\n  \"name\": \"\",\n  \"code\": \"\",\n  \"detail\": \"\",\n  \"reason\": \"\"\n}"
        },
        {
          "id": "fd12nbsuKXQu5nuVSiDHr",
          "language": "404",
          "code": "// The requested resource was not found.\n{\n  \"name\": \"\",\n  \"code\": \"\",\n  \"detail\": \"\",\n  \"reason\": \"\"\n}"
        },
        {
          "id": "cudCMAPqODZucz9Lqwhgg",
          "language": "409",
          "code": "// The request conflicts with the current state of the resource (e.g., the customer is already under legal hold).\n{\n  \"name\": \"\",\n  \"code\": \"\",\n  \"detail\": \"\",\n  \"reason\": \"\"\n}"
        },
        {
          "id": "09aOh3bb-31e_5VDkNPDU",
          "language": "500",
          "code": "// There was an internal server error.\n{\n  \"name\": \"\",\n  \"code\": \"\",\n  \"detail\": \"\",\n  \"reason\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "bXhVqkmpd3lflPQYHlQ49"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}