Skip to main content
PUT
Set player consent
Records the tracking consent of one player. When a player answers your consent banner or changes the choice in your settings, call it from your backend. A new call replaces the record. Manalens does not enforce consent. It stores the record so that you can read it back and show it in an audit. You decide what your SDKs and servers send for each level:

Authentication

Use an API key (mana_api_...) with the consent:write scope. See Authentication.
  • The key works on its own project only. Another project’s key gets 404.
  • The key’s creator must be an owner, admin or editor.
  • It works on every plan. The workspace needs an active subscription or trial.
  • Call it from a server. A request with a browser Origin header gets 403.
  • The demo project is read-only: 403.
Give the key only consent:write. Use a separate key for player deletes.

Path parameters

You can record consent before the player has any data in Manalens.

Body

Response

200 with the stored record:

Example

Deleting the record

Deleting the player deletes the record of the user key and of every anonymous ID that the delete covers. Deleting the project also deletes the record. The audit log has a player.consent_set row for each write. The row holds a hash of the player key, the status and the source, never the player’s IDs.

Errors

See Errors for the error format.

Authorizations

Authorization
string
header
required

An API key (mana_api_...) with scopes. It reads reports and writes player traits.

Path Parameters

projectId
string<uuid>
required

The project ID

playerKey
string
required

The player key: user: and the user ID that you send with identify (1 to 255 characters), or anon: and an anonymous ID (a UUID) for a player that never identified. URL-encode it, for example user%3Aplayer-42.

Required string length: 6 - 260
Pattern: ^(user|anon):

Body

application/json
status
enum<string>
required

none: no tracking. anonymous: tracking without identity or personal data. full: all tracking.

Available options:
none,
anonymous,
full
source
string
required

Where the player chose, for example cookie-banner-v1. 1 to 128 characters.

Required string length: 1 - 128

Response

The record was written

player_key
string
required

The player key, with an anonymous ID in lowercase

status
enum<string>
required

none: the player declined tracking. anonymous: the player allows tracking without identity. full: the player allows full tracking. not_set: no record exists, so treat it as none.

Available options:
not_set,
none,
anonymous,
full
source
string | null
required

Where the consent was given, as you sent it, for example cookie-banner-v1. null for not_set.

updated_at
string | null
required

When the record was last written (ISO 8601). null for not_set.