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

# Get Referrals Report V2

> Get referral traffic report from the hourly aggregated materialized view (UTC-based).

Supports date_interval="hour", calendar intervals through "year", "quarter", and "relative_week".



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/profound/openapi.documented.yml post /v2/reports/referrals
openapi: 3.1.0
info:
  title: External API
  version: 47f2d601551a89dba69bb4759a8bbe6800ee930c
servers:
  - url: https://api.tryprofound.com
    description: Production Server
security: []
paths:
  /v2/reports/referrals:
    post:
      tags:
        - Reports
        - Human Referrals
      summary: Get Referrals Report V2
      description: >-
        Get referral traffic report from the hourly aggregated materialized view
        (UTC-based).


        Supports date_interval="hour", calendar intervals through "year",
        "quarter", and "relative_week".
      operationId: get_referrals_report_v2_v2_reports_referrals_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReferralsQueryV2'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - BearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Profound from '@profoundai/client';

            const client = new Profound({
              apiKey: process.env['PROFOUND_API_KEY'], // This is the default and can be omitted
            });

            const reportResponse = await client.reports.getReferralsReportV2({
              domain: 'domain',
              metrics: ['visits'],
              start_date: '2019-12-27T18:11:19.117Z',
            });

            console.log(reportResponse.data);
        - lang: Python
          source: |-
            import os
            from datetime import datetime
            from profound import Profound

            client = Profound(
                api_key=os.environ.get("PROFOUND_API_KEY"),  # This is the default and can be omitted
            )
            report_response = client.reports.get_referrals_report_v2(
                domain="domain",
                metrics=["visits"],
                start_date=datetime.fromisoformat("2019-12-27T18:11:19.117"),
            )
            print(report_response.data)
components:
  schemas:
    ReferralsQueryV2:
      properties:
        date_interval:
          type: string
          enum:
            - hour
            - day
            - week
            - month
            - quarter
            - year
            - relative_week
          title: Date Interval
          description: Date interval for the report. (only used with date dimension)
          default: day
        dimensions:
          items:
            type: string
            enum:
              - date
              - hour
              - path
              - referral_source
              - referral_type
          type: array
          title: Dimensions
          description: Dimensions to group the report by.
          default: []
        metrics:
          items:
            type: string
            enum:
              - visits
              - last_visit
          type: array
          title: Metrics
        order_by:
          additionalProperties:
            type: string
            enum:
              - asc
              - desc
          propertyNames:
            enum:
              - date
              - hour
              - path
              - referral_source
              - visits
              - last_visit
              - referral_type
          type: object
          title: Order By
          description: >-

            Custom ordering of the report results.


            The order is a record of key-value pairs where:

            - key is the field to order by, which can be a metric or dimension

            - value is the direction of the order, either 'asc' for ascending or
            'desc' for descending.


            When not specified, the default order is the first metric in the
            query descending.
                    
          default: {}
          examples:
            - date: asc
        pagination:
          $ref: '#/components/schemas/Pagination'
          description: Pagination settings for the report results.
        domain:
          type: string
          title: Domain
          description: Domain to query logs for.
        start_date:
          type: string
          format: date-time
          title: Start Date
          description: >-
            Start date for logs. Accepts: YYYY-MM-DD, YYYY-MM-DD HH:MM,
            YYYY-MM-DD HH:MM:SS, or full ISO timestamp.
        end_date:
          type: string
          format: date-time
          title: End Date
          description: >-
            End date in UTC. Accepts same formats as start_date. Defaults to now
            UTC if omitted.
        organization_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Organization Id
        metric_filters:
          items:
            $ref: '#/components/schemas/NumericMetricFilter'
          type: array
          title: Metric Filters
          description: Numeric filters applied after report metrics are calculated.
        filters:
          items:
            oneOf:
              - $ref: '#/components/schemas/PathFilter'
              - $ref: '#/components/schemas/ReferralSourceFilter'
              - $ref: '#/components/schemas/ReferralTypeFilter'
            discriminator:
              propertyName: field
              mapping:
                path:
                  $ref: '#/components/schemas/PathFilter'
                referral_source:
                  $ref: '#/components/schemas/ReferralSourceFilter'
                referral_type:
                  $ref: '#/components/schemas/ReferralTypeFilter'
          type: array
          title: Filters
          description: Filters for referrals report.
      type: object
      required:
        - metrics
        - domain
        - start_date
      title: ReferralsQueryV2
    Response:
      properties:
        info:
          $ref: '#/components/schemas/Info'
        data:
          items:
            $ref: '#/components/schemas/Result'
          type: array
          title: Data
      type: object
      required:
        - info
        - data
      title: Response
      description: Base response model for reports.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Pagination:
      properties:
        limit:
          type: integer
          maximum: 50000
          exclusiveMinimum: 0
          title: Limit
          description: >-
            Maximum number of results to return. Default is 10,000, maximum is
            50,000.
          default: 10000
        offset:
          type: integer
          minimum: 0
          title: Offset
          description: Offset for the results. Used for pagination.
          default: 0
      type: object
      title: Pagination
      description: Offset-based pagination parameters.
    NumericMetricFilter:
      properties:
        field:
          type: string
          title: Field
        operator:
          type: string
          enum:
            - '>'
            - '>='
            - <
            - <=
            - '='
            - '=='
            - '!='
          title: Operator
        value:
          anyOf:
            - type: integer
            - type: number
          title: Value
      type: object
      required:
        - field
        - operator
        - value
      title: NumericMetricFilter
    PathFilter:
      properties:
        field:
          type: string
          const: path
          title: Field
        operator:
          type: string
          enum:
            - is
            - not_is
            - in
            - not_in
            - contains
            - not_contains
            - matches
            - contains_case_insensitive
            - not_contains_case_insensitive
          title: Operator
        value:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
          title: Value
      type: object
      required:
        - field
        - operator
        - value
      title: PathFilter
      description: Filter by request path
    ReferralSourceFilter:
      properties:
        field:
          type: string
          const: referral_source
          title: Field
        operator:
          type: string
          enum:
            - is
            - not_is
            - in
            - not_in
            - contains
            - not_contains
            - matches
            - contains_case_insensitive
            - not_contains_case_insensitive
          title: Operator
        value:
          anyOf:
            - type: string
              enum:
                - openai
                - none
                - anthropic
                - deepseek
                - perplexity
                - you
                - grok
                - microsoft
                - gemini
                - internal
                - other
            - items:
                type: string
                enum:
                  - openai
                  - none
                  - anthropic
                  - deepseek
                  - perplexity
                  - you
                  - grok
                  - microsoft
                  - gemini
                  - internal
                  - other
              type: array
          title: Value
      type: object
      required:
        - field
        - operator
        - value
      title: ReferralSourceFilter
      description: Filter by referral source
    ReferralTypeFilter:
      properties:
        field:
          type: string
          const: referral_type
          title: Field
        operator:
          type: string
          enum:
            - is
            - not_is
            - in
            - not_in
            - contains
            - not_contains
            - matches
            - contains_case_insensitive
            - not_contains_case_insensitive
          title: Operator
        value:
          anyOf:
            - type: string
              enum:
                - internal
                - referer
                - utm
                - none
            - items:
                type: string
                enum:
                  - internal
                  - referer
                  - utm
                  - none
              type: array
          title: Value
      type: object
      required:
        - field
        - operator
        - value
      title: ReferralTypeFilter
      description: Filter by referral type
    Info:
      properties:
        total_rows:
          type: integer
          title: Total Rows
        query:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Query
      type: object
      required:
        - total_rows
      title: Info
      description: Base model for report information.
    Result:
      properties:
        metrics:
          items:
            anyOf:
              - type: integer
              - type: number
          type: array
          title: Metrics
        dimensions:
          items:
            anyOf:
              - type: string
              - type: string
                format: uuid
          type: array
          title: Dimensions
      type: object
      required:
        - metrics
        - dimensions
      title: Result
      description: Base model for report results.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    BearerAuth:
      type: http
      scheme: bearer

````