> ## 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.

# Get attribution

> Conversions and revenue credited to each group by a rule-based model. A journey follows one browser or game install across days; the website and the game join through identify or a game handoff link.



## OpenAPI

````yaml /api/openapi.json get /v0/projects/{projectId}/query/attribution
openapi: 3.1.0
info:
  title: Manalens API
  version: 0.1.0
  description: >-
    The public API of Manalens: event ingestion, profile properties 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: Profiles
    description: Set and delete profile properties
  - name: Query
    description: Read analytics reports with an API key
paths:
  /v0/projects/{projectId}/query/attribution:
    get:
      tags:
        - Query
      summary: Get attribution
      description: >-
        Conversions and revenue credited to each group by a rule-based model. A
        journey follows one browser or game install across days; the website and
        the game join through identify or a game handoff link.
      operationId: getAttribution
      parameters:
        - name: projectId
          in: path
          required: true
          description: The project ID
          schema:
            type: string
            format: uuid
        - name: conversion_event
          in: query
          required: true
          description: The custom event that counts as a conversion, for example purchase
          schema:
            type: string
            minLength: 1
            maxLength: 128
        - name: model
          in: query
          required: false
          description: 'Default: last_non_direct'
          schema:
            type: string
            enum:
              - first_touch
              - last_touch
              - last_non_direct
              - linear
              - position_based
              - time_decay
        - name: group_by
          in: query
          required: false
          description: 'Default: source'
          schema:
            type: string
            enum:
              - channel_type
              - source
              - medium
              - campaign
              - content
              - paid_source
              - referrer
              - ref
              - click_id
        - name: lookback_days
          in: query
          required: false
          description: >-
            Days before a conversion that a touch can get credit: 1 to 365.
            Default: 30.
          schema:
            type: string
            pattern: ^\d{1,3}$
        - name: half_life_days
          in: query
          required: false
          description: 'time_decay only: 1 to 30. Default: 7.'
          schema:
            type: string
            pattern: ^\d{1,2}(\.\d+)?$
        - $ref: '#/components/parameters/date_from'
        - $ref: '#/components/parameters/date_to'
        - $ref: '#/components/parameters/paid_source'
        - $ref: '#/components/parameters/channel_type'
        - $ref: '#/components/parameters/click_id'
        - $ref: '#/components/parameters/utm_source'
        - $ref: '#/components/parameters/utm_campaign'
      responses:
        '200':
          description: The report
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportRows'
        '400':
          description: >-
            `INVALID_QUERY`: a parameter or the body is not valid. The message
            names the problem.
          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 Scale plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            `FORBIDDEN`: the key does not have the scope, its creator left the
            workspace, or the request came from a browser
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            `NOT_FOUND`: the key belongs to another project, or the resource
            does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: '`TOO_MANY_REQUESTS`: the key or workspace budget is used up'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          headers:
            Retry-After:
              description: Seconds to wait before a retry
              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:
  parameters:
    date_from:
      name: date_from
      in: query
      required: false
      description: 'First day (UTC) as YYYY-MM-DD. Default: 29 days before date_to.'
      schema:
        type: string
        pattern: ^\d{4}-\d{2}-\d{2}$
    date_to:
      name: date_to
      in: query
      required: false
      description: >-
        Last day (UTC) as YYYY-MM-DD. Default: today. The range is at most 367
        days.
      schema:
        type: string
        pattern: ^\d{4}-\d{2}-\d{2}$
    paid_source:
      name: paid_source
      in: query
      required: false
      description: Ad network of a paid click
      schema:
        type: string
        enum:
          - google
          - meta
          - microsoft
          - tiktok
          - twitter
          - linkedin
          - reddit
          - snapchat
          - paid_utm
    channel_type:
      name: channel_type
      in: query
      required: false
      description: Acquisition channel
      schema:
        type: string
        enum:
          - Paid Search
          - Paid Video
          - Paid Social
          - Paid Other
          - Email
          - Referrals
          - Display
          - AI
          - Organic Search
          - Organic Social
          - Organic Video
          - Referrers
          - Direct
    click_id:
      name: click_id
      in: query
      required: false
      description: Ad click ID (gclid, fbclid and others)
      schema:
        type: string
        maxLength: 255
    utm_source:
      name: utm_source
      in: query
      required: false
      schema:
        type: string
        maxLength: 255
    utm_campaign:
      name: utm_campaign
      in: query
      required: false
      schema:
        type: string
        maxLength: 255
  schemas:
    ReportRows:
      type: object
      properties:
        date_from:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: First day of the report
        date_to:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: Last day of the report
        rows:
          type: array
          items:
            type: object
            propertyNames:
              type: string
            additionalProperties: {}
      required:
        - date_from
        - date_to
        - rows
    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
          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
        profile properties.

````

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