> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://contentful.com/developers/docs/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/_mcp/server. # Update a profile POST https://experience.ninetailed.co/v2/organizations/{organizationId}/environments/{environmentSlug}/profiles/{profileId} Content-Type: application/json Updates an existing profile and returns it with updated variant selections. The `organizationId` is the **Client ID** from **Settings → SDK Keys → Optimization**. Reference: https://contentful.com/developers/docs/references/experience-api/profiles/update-a-profile ## Request ### Path parameters - `environmentSlug` (string, required, default: main) — The slug of the environment of the profile to retrieve - `organizationId` (string, required) — The ID of the organization of the profile to retrieve - `profileId` (string, required) — The ID of the profile to retrieve ### Query parameters - `locale` (string, optional, default: en) — An ISO 639-1 language code used for experience evaluation. - `type` (enum, optional) — Set to `preflight` to evaluate experiences without persisting state. Useful for SSR/ESR. - Allowed values: `preflight` ## Response ### 200 Successful response ## Errors ### 400 Bad Request Error Bad Request - `message` (string, required) - `data` (BadRequestData, required) - `error` (BadRequestError, optional) ### 404 Not Found Error Organization or environment not found - `UpdateAProfileRequestNotFoundError` ### 429 Too Many Requests Error Profile overload - `UpdateAProfileRequestTooManyRequestsError` ### 500 Internal Server Error Internal server error - `message` (string, required) - `data` (InternalServerErrorData, required) - `error` (InternalServerErrorError, optional) ## Types ### BadRequestData ### BadRequestError - `code` (string, optional) ### configNotFoundError - `message` (string, required) - `data` (ConfigNotFoundErrorData, required) - `error` (ConfigNotFoundErrorError, optional) ### notFoundError - `message` (string, required) - `data` (NotFoundErrorData, required) - `error` (NotFoundErrorError, optional) ### profileOverloadError - `message` (string, required) - `data` (ProfileOverloadErrorData, required) - `error` (ProfileOverloadErrorError, optional) ### tooManyRequests - `message` (string, required) - `data` (TooManyRequestsData, required) - `error` (TooManyRequestsError, optional) ### InternalServerErrorData ### InternalServerErrorError - `code` (string, optional) ### ConfigNotFoundErrorData ### ConfigNotFoundErrorError - `code` (string, optional) ### NotFoundErrorData ### NotFoundErrorError - `code` (string, optional) ### ProfileOverloadErrorData ### ProfileOverloadErrorError - `code` (string, optional) ### TooManyRequestsData ### TooManyRequestsError - `code` (string, optional) ## Examples **Request** ```json { "events": [ { "channel": "web", "context": { "app": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "campaign": {}, "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" }, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" }, "messageId": "58f358f2-a858-11ed-afa1-0242ac120002", "timestamp": "2022-10-10T14:36:51.262Z", "traits": { "favAnimal": "fox" }, "type": "identify", "userId": "asdf" } ] } ``` **Response** ```json { "data": { "changes": [ { "key": "heroTitle", "meta": { "experienceId": "exp-2", "variantIndex": 1 }, "type": "Variable", "value": "Welcome back!" } ], "experiences": [ { "experienceId": "exp-1", "variantIndex": 1, "variants": { "entryA": "entryB" } } ], "profile": { "audiences": [ "audience-1" ], "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "location": {}, "random": 0.42, "session": {}, "stableId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "traits": { "favAnimal": "fox" } } }, "error": null, "message": "ok" } ``` **SDK Code** ```javascript JavaScript const response = await fetch('https://experience.ninetailed.co/v2/organizations/{organizationId}/environments/{environmentSlug}/profiles/{profileId}', { method: 'POST', headers: { "Content-Type": "application/json" }, body: JSON.stringify({ "events": [ { "channel": "web", "context": { "app": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36", "campaign": {}, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" } }, "messageId": "58f358f2-a858-11ed-afa1-0242ac120002", "timestamp": "2022-10-10T14:36:51.262Z", "type": "identify", "traits": { "favAnimal": "fox" }, "userId": "asdf" } ] }), }); const data = await response.json(); ``` ```python Python import requests response = requests.post( "https://experience.ninetailed.co/v2/organizations/{organizationId}/environments/{environmentSlug}/profiles/{profileId}", headers={"Content-Type":"application/json"}, json={"events":[{"channel":"web","context":{"app":{"name":"Ninetailed Analytics SDK","version":"1.0.0"},"library":{"name":"Ninetailed Analytics SDK","version":"1.0.0"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36","campaign":{},"locale":"en-US","page":{"path":"/","query":{},"referrer":"","search":"","url":"https://example.com/"}},"messageId":"58f358f2-a858-11ed-afa1-0242ac120002","timestamp":"2022-10-10T14:36:51.262Z","type":"identify","traits":{"favAnimal":"fox"},"userId":"asdf"}]} ) data = response.json() ``` ```http HTTP POST /v2/organizations/{organizationId}/environments/{environmentSlug}/profiles/{profileId} HTTP/1.1 Host: experience.ninetailed.co Content-Type: application/json Accept: */* { "events": [ { "channel": "web", "context": { "app": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36", "campaign": {}, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" } }, "messageId": "58f358f2-a858-11ed-afa1-0242ac120002", "timestamp": "2022-10-10T14:36:51.262Z", "type": "identify", "traits": { "favAnimal": "fox" }, "userId": "asdf" } ] } ```