> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manalens.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete player data

> Delete all data of one player: the profile and traits, the events of every browser and game install of the player, labels, account links (Steam, itch.io, Discord), Steam ownership, purchases, summaries, wishlist and library data, and the links of revenue records. Use it when a player deletes their account or asks for erasure. Postgres rows go at once; the analytics deletes run as background jobs and finish within minutes. It cannot be undone. A repeated call while the request runs returns the same request and queues nothing. Stop sending events for the player first: new events make a new player.



## OpenAPI

````yaml /api/openapi.json delete /v0/projects/{projectId}/players/{playerKey}
openapi: 3.1.0
info:
  title: Manalens API
  version: 0.1.0
  description: >-
    The public API of Manalens: event ingestion, Steam account links, player
    traits, player deletes and the Query API. Success bodies are the resource,
    with no envelope. Errors use the `Error` format. See
    https://docs.manalens.dev/api/overview.
servers:
  - url: https://api.manalens.dev
    description: API
  - url: https://events.manalens.dev
    description: Event ingestion
security: []
tags:
  - name: Events
    description: Send website, game and server events
  - name: Accounts
    description: Link the Steam account of a player to the game install
  - name: Players
    description: Set and delete the traits of identified players
  - name: Query
    description: Read analytics reports with an API key
paths:
  /v0/projects/{projectId}/players/{playerKey}:
    delete:
      tags:
        - Players
      summary: Delete player data
      description: >-
        Delete all data of one player: the profile and traits, the events of
        every browser and game install of the player, labels, account links
        (Steam, itch.io, Discord), Steam ownership, purchases, summaries,
        wishlist and library data, and the links of revenue records. Use it when
        a player deletes their account or asks for erasure. Postgres rows go at
        once; the analytics deletes run as background jobs and finish within
        minutes. It cannot be undone. A repeated call while the request runs
        returns the same request and queues nothing. Stop sending events for the
        player first: new events make a new player.
      operationId: deletePlayer
      parameters:
        - name: projectId
          in: path
          required: true
          description: The project ID
          schema:
            type: string
            format: uuid
        - name: playerKey
          in: path
          required: true
          description: >-
            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`.
          schema:
            type: string
            minLength: 6
            maxLength: 260
            pattern: '^(user|anon):'
      responses:
        '202':
          description: >-
            The delete is queued, or an earlier request of this player is
            returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  request_id:
                    type: string
                    description: >-
                      The ID of the delete request. A repeated call returns the
                      same ID while the request runs.
                  player_key:
                    type: string
                    description: The player key
                  status:
                    type: string
                    enum:
                      - queued
                      - pending
                      - done
                      - failed
                    description: >-
                      `queued`: this call started the delete. `pending`: an
                      earlier request of this player still runs, and nothing new
                      was queued. `done`: an earlier request finished, and
                      Manalens has no new data of the player. `failed`: a job of
                      the earlier request failed; contact support.
                  installs:
                    type: object
                    properties:
                      count:
                        type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                        description: >-
                          The number of browsers and game installs that the
                          delete covers
                      anonymous_ids:
                        type: array
                        items:
                          type: string
                        description: Their anonymous IDs
                    required:
                      - count
                      - anonymous_ids
                  deleted:
                    anyOf:
                      - type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                      - type: 'null'
                    description: >-
                      The rows deleted at once (account links, owned products,
                      purchases, Steam summaries and library state, itch.io
                      matches, segment alert members, install match keys). Only
                      on the call that started the delete; null on a repeated
                      call.
                  jobs:
                    type: array
                    items:
                      type: string
                    description: >-
                      The background jobs of the request: one per analytics
                      datasource, raw_events last
                  message:
                    type: string
                required:
                  - request_id
                  - player_key
                  - status
                  - installs
                  - deleted
                  - jobs
                  - message
              example:
                request_id: 0f6f4b8e-1c2d-4e5f-8a9b-0c1d2e3f4a5b
                player_key: user:player_42
                status: queued
                installs:
                  count: 2
                  anonymous_ids:
                    - 6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11
                    - b1c2d3e4-f5a6-4b7c-8d9e-0f1a2b3c4d5e
                deleted:
                  account_links: 1
                  player_products: 1
                  player_purchases: 0
                jobs:
                  - user_profiles_mv
                  - labels
                  - raw_events
                message: >-
                  The delete runs as background jobs. It finishes within
                  minutes.
        '400':
          description: >-
            `INVALID_PLAYER_KEY`: the player key is not `user:<user_id>` or
            `anon:<anonymous_id>`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            `UNAUTHORIZED`: the API key is missing, malformed, unknown or
            revoked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: >-
            `SUBSCRIPTION_REQUIRED`: the workspace has no active subscription or
            trial. `PLAN_UPGRADE_REQUIRED`: API keys need the Studio plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            `FORBIDDEN`: the key has no `profiles:delete` scope, its creator is
            not an owner or admin, the request came from a browser, or the
            project is the demo project. `WORKSPACE_SUSPENDED`: the workspace is
            suspended.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            `NOT_FOUND`: the key belongs to another project. `PLAYER_NOT_FOUND`:
            the project has no data of this player.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            `NOT_CANONICAL`: the anonymous ID belongs to an identified player.
            Delete that player: `error.player_key` is its key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            `PLAYER_TOO_LARGE`: the player has more than 1000 IDs of one kind.
            Contact support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            `TOO_MANY_REQUESTS`: the key or workspace budget is used up.
            `RATE_LIMITED`: the project sent more than 60 player deletes this
            minute or 5000 this day.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          headers:
            Retry-After:
              description: Seconds to wait before a retry
              schema:
                type: integer
            RateLimit-Limit:
              description: The limit of the window, when it is known
              schema:
                type: integer
            RateLimit-Policy:
              description: '`<limit>;w=<window seconds>`, when the limit is known'
              schema:
                type: string
            RateLimit-Remaining:
              description: Always 0 on a 429
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets (the same as Retry-After)
              schema:
                type: integer
        '500':
          description: '`INTERNAL`: an unexpected error. The body has a `request_id`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKey: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable, machine-readable code. Branch on it.
            message:
              type: string
              description: A human-readable text. The wording can change.
            request_id:
              description: 'INTERNAL only: quote it when you contact support'
              type: string
            issues:
              description: 'INVALID_EVENT only: up to five validation issues'
              type: array
              items:
                type: object
                properties:
                  path:
                    type: string
                    description: Where the problem is, such as `events.0.properties`
                  message:
                    type: string
                    description: What is wrong, such as `at most 50 keys`
                required:
                  - path
                  - message
            refused:
              description: >-
                INVALID_EVENT when no event of the batch is accepted: each
                refused event (the same list as `errors`, kept for SDKs that
                read it here)
              type: array
              items:
                type: object
                properties:
                  index:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: The position of the event in the batch
                  message_id:
                    description: The message_id of the event, or null when it has none
                    type:
                      - string
                      - 'null'
                  code:
                    type: string
                    description: >-
                      The reason code, such as `INVALID_EVENT`,
                      `SESSION_ID_REQUIRED` or `FORBIDDEN`
                  message:
                    type: string
                    description: 'What is wrong, such as `properties: at most 50 keys`'
                required:
                  - index
                  - message_id
                  - code
                  - message
            results:
              description: 'INVALID_TRAITS of a batch trait update: the result of each item'
              type: array
              items:
                type: object
                properties:
                  index:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  user_id:
                    type: string
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - index
            feature:
              description: >-
                PLAN_UPGRADE_REQUIRED only: the plan feature that the request
                needs
              type: string
            billing_url:
              description: 'PLAN_UPGRADE_REQUIRED only: the billing page of the workspace'
              type: string
          required:
            - code
            - message
      required:
        - error
      description: >-
        The error format of every endpoint. See
        https://docs.manalens.dev/api/errors.
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      description: >-
        An API key (`mana_api_...`) with scopes. It reads reports and writes
        player traits.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.