> 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. # Create or update profiles (sync) POST https://experience.ninetailed.co/v2/organizations/{organizationId}/environments/{environmentSlug}/events Content-Type: application/json Upserts up to 200 profiles from a batch of events (max 50 identify events, 50 unique profiles); returns profiles only — no `experiences` or `changes`. Intended for server-side use and does not resolve location or IP address. Reference: https://contentful.com/developers/docs/references/experience-api/profiles/create-or-update-profiles-sync ## 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 ### Query parameters - `locale` (string, optional, default: en) — An ISO 639-1 language code used for experience evaluation. ## Response ### 200 Successful response ## Errors ### 400 Bad Request Error Bad Request - `message` (string, required) - `data` (BadRequestData, required) - `error` (BadRequestError, optional) ### 404 Not Found Error Profile not found - `CreateOrUpdateProfilesSyncRequestNotFoundError` ### 429 Too Many Requests Error Profile overload - `CreateOrUpdateProfilesSyncRequestTooManyRequestsError` ### 500 Internal Server Error Internal server error - `message` (string, required) - `data` (InternalServerErrorData, required) - `error` (InternalServerErrorError, optional) ## Types ### BadRequestData ### BadRequestError - `code` (string, optional) ### profileNotFoundError - `message` (string, required) - `data` (ProfileNotFoundErrorData, required) - `error` (ProfileNotFoundErrorError, 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) ### ProfileNotFoundErrorData ### ProfileNotFoundErrorError - `code` (string, optional) ### NotFoundErrorData ### NotFoundErrorError - `code` (string, optional) ### ProfileOverloadErrorData ### ProfileOverloadErrorError - `code` (string, optional) ### TooManyRequestsData ### TooManyRequestsError - `code` (string, optional) ## Examples **Request** ```json { "events": [ { "anonymousId": "18635fe9cc665fd113547e897c13862b", "channel": "web", "context": { "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" } }, "messageId": "58f358f2-a858-11ed-afa1-0242ac120002", "properties": { "hash": "", "height": 1226, "path": "/", "query": {}, "referrer": "", "search": "", "title": "Sample Page", "url": "https://example.com/", "width": 1419 }, "timestamp": "2022-01-01T00:00:00.000Z", "type": "page" }, { "anonymousId": "18635fe9cc665fd113547e897c13862b", "channel": "web", "context": { "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" } }, "messageId": "68a459e3-b959-22fe-bfb2-1353bd230003", "timestamp": "2022-01-01T00:00:01.000Z", "traits": {}, "type": "identify", "userId": "user1" } ] } ``` **Response** ```json { "data": { "profiles": [ { "audiences": [], "id": "18635fe9cc665fd113547e897c13862b", "location": {}, "random": 0.73, "session": {}, "stableId": "18635fe9cc665fd113547e897c13862b", "traits": {} } ] }, "error": null, "message": "ok" } ``` **SDK Code** ```javascript JavaScript const response = await fetch('https://experience.ninetailed.co/v2/organizations/{organizationId}/environments/{environmentSlug}/events', { method: 'POST', headers: { "Content-Type": "application/json" }, body: JSON.stringify({ "events": [ { "channel": "web", "context": { "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" } }, "messageId": "58f358f2-a858-11ed-afa1-0242ac120002", "anonymousId": "18635fe9cc665fd113547e897c13862b", "timestamp": "2022-01-01T00:00:00.000Z", "type": "page", "properties": { "title": "Sample Page", "url": "https://example.com/", "path": "/", "hash": "", "search": "", "width": 1419, "height": 1226, "query": {}, "referrer": "" } }, { "channel": "web", "context": { "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" } }, "messageId": "68a459e3-b959-22fe-bfb2-1353bd230003", "anonymousId": "18635fe9cc665fd113547e897c13862b", "userId": "user1", "traits": {}, "timestamp": "2022-01-01T00:00:01.000Z", "type": "identify" } ] }), }); const data = await response.json(); ``` ```python Python import requests response = requests.post( "https://experience.ninetailed.co/v2/organizations/{organizationId}/environments/{environmentSlug}/events", headers={"Content-Type":"application/json"}, json={"events":[{"channel":"web","context":{"library":{"name":"Ninetailed Analytics SDK","version":"1.0.0"},"locale":"en-US","page":{"path":"/","query":{},"referrer":"","search":"","url":"https://example.com/"}},"messageId":"58f358f2-a858-11ed-afa1-0242ac120002","anonymousId":"18635fe9cc665fd113547e897c13862b","timestamp":"2022-01-01T00:00:00.000Z","type":"page","properties":{"title":"Sample Page","url":"https://example.com/","path":"/","hash":"","search":"","width":1419,"height":1226,"query":{},"referrer":""}},{"channel":"web","context":{"library":{"name":"Ninetailed Analytics SDK","version":"1.0.0"},"locale":"en-US","page":{"path":"/","query":{},"referrer":"","search":"","url":"https://example.com/"}},"messageId":"68a459e3-b959-22fe-bfb2-1353bd230003","anonymousId":"18635fe9cc665fd113547e897c13862b","userId":"user1","traits":{},"timestamp":"2022-01-01T00:00:01.000Z","type":"identify"}}]} ) data = response.json() ``` ```http HTTP POST /v2/organizations/{organizationId}/environments/{environmentSlug}/events HTTP/1.1 Host: experience.ninetailed.co Content-Type: application/json Accept: */* { "events": [ { "channel": "web", "context": { "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" } }, "messageId": "58f358f2-a858-11ed-afa1-0242ac120002", "anonymousId": "18635fe9cc665fd113547e897c13862b", "timestamp": "2022-01-01T00:00:00.000Z", "type": "page", "properties": { "title": "Sample Page", "url": "https://example.com/", "path": "/", "hash": "", "search": "", "width": 1419, "height": 1226, "query": {}, "referrer": "" } }, { "channel": "web", "context": { "library": { "name": "Ninetailed Analytics SDK", "version": "1.0.0" }, "locale": "en-US", "page": { "path": "/", "query": {}, "referrer": "", "search": "", "url": "https://example.com/" } }, "messageId": "68a459e3-b959-22fe-bfb2-1353bd230003", "anonymousId": "18635fe9cc665fd113547e897c13862b", "userId": "user1", "traits": {}, "timestamp": "2022-01-01T00:00:01.000Z", "type": "identify" } ] } ```