---
title: Save saves user profile.
slug: feature-experimentation/api/save-saves-user-profile
docTags: 
createdAt: 2026-08-28T15:54:06.731Z
---

{
  "id": "NlkrM8XQMNBLDPrGj6vUn",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/v1/save",
    "servers": [],
    "name": "Save saves user profile.",
    "description": "Saves user profile for a user.",
    "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": "",
          "customType": "SaveContext",
          "schema": [
            {
              "name": "experimentBucketMap",
              "kind": "optional",
              "type": "object",
              "description": "",
              "modelRef": "#/components/schemas/ExperimentBucketMap",
              "customType": "ExperimentBucketMap",
              "schema": [
                {
                  "name": "your_experiment_id",
                  "kind": "optional",
                  "type": "object",
                  "description": "",
                  "modelRef": "#/components/schemas/YourExperimentId",
                  "customType": "YourExperimentId",
                  "schema": [
                    {
                      "name": "variation_id",
                      "kind": "optional",
                      "type": "string",
                      "description": ""
                    }
                  ]
                }
              ]
            },
            {
              "name": "userId",
              "kind": "optional",
              "type": "string",
              "description": ""
            }
          ],
          "modelRef": "#/components/schemas/SaveContext",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "SdkKeyAuth",
          "name": "X-Optimizely-SDK-Key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        },
        {
          "id": "TokenAuth",
          "name": "TokenAuth",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>Valid response, Profile saved.</p>",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Missing required parameters",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "<p>Unauthorized, invalid JWT</p>",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "You do not have necessary permissions for the resource",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "You do not have necessary permissions for the resource",
            "customType": "Forbidden",
            "schema": [],
            "modelRef": "#/components/responses/Forbidden",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "500",
        "description": "User Profile Service not found",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "deprecated": false,
    "examples": {
      "languages": [
        {
          "id": "HYp6XHLuKUAuA6dN4BBeY",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /v1/save \\\n     --header 'accept: application/json'"
        },
        {
          "id": "nMflXSpGGvK7YtjxzR44-",
          "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: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/v1/save\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "zueXRIcYB6kLIW4vKuQBc",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/v1/save\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "Qs7xvbsMQC4udJja_ozSH",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/v1/save\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "HYp6XHLuKUAuA6dN4BBeY"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Valid response, Profile saved.\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Missing required parameters\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized, invalid JWT\n"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// You do not have necessary permissions for the resource\n{}"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// User Profile Service not found\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}