Ahrefs Traffic Sources API

The Traffic Sources API from Ahrefs — 8 operation(s) for traffic sources.

Operations 8

GET /source-channels Source Channels #
GET /source-channels-chart Source Channels Chart #
GET /sources Sources #
GET /sources-chart Sources Chart #
GET /referrers Referrers #
GET /referrers-chart Referrers Chart #
GET /utm-params UTM Parameters #
GET /utm-params-chart UTM Parameters Chart #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/ahrefs-traffic-sources-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

ahrefs-traffic-sources-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Web Analytics Traffic Sources API
  description: Web_analytics.
  termsOfService: https://ahrefs.com/terms
  contact:
    name: Ahrefs
    url: https://ahrefs.com/
    email: support@ahrefs.com
  version: 3.0.0
servers:
- url: https://api.ahrefs.com/v3/web-analytics
  description: Ahrefs Web Analytics
security:
- http:
  - read
tags:
- name: Traffic Sources
paths:
  /source-channels:
    get:
      tags:
      - Traffic Sources
      summary: Source Channels
      description: '>Requests to this endpoint are free and do not consume any API units.'
      operationId: source-channels
      parameters:
      - description: The number of results to return.
        required: false
        explode: false
        schema:
          type: integer
        name: limit
        in: query
      - description: "Order by metric, as `metric:desc` or `metric:asc`. The following metrics are supported:\n\n**pageviews**: Number of pageview events  \ntype: integer\n\n**visitors**: Number of visitors  \ntype: integer\n\n**visits**: Number of visits  \ntype: integer\n\n**session_bounce_rate**: Session bounce rate (percentage of sessions that triggered only one request)  \ntype: float\n\n**avg_session_length**: Average session length (in seconds)  \ntype: float\n\n**avg_session_duration_sec**: Average session duration (in seconds)  \ntype: integer\n\n**exit_rate**: Exit rate (percentage of pageviews that were the last in the session)  \ntype: float\n\n**exits**: Number of exits  \ntype: integer\n\n**entries**: Number of entries  \ntype: integer\n\n**avg_page_visit_duration_sec**: Average page visit duration (in seconds)  \ntype: integer"
        required: false
        explode: false
        schema:
          type: string
        name: order_by
        in: query
      - description: "Filter expression. Can mention dimensions and metrics.\n\nThe following dimensions are supported:\n\n**source_channel**: Source Channel  \ntype: enum (search \\| llm \\| email \\| paid \\| search/paid \\| social \\| unknown \\| direct \\| newsletter \\| shopping/organic \\| shopping/paid \\| audio \\| social/paid \\| cross-network \\| mobile-push-notification \\| sms \\| affiliate \\| referral \\| display \\| internal)\n\n**source**: Source  \ntype: string\n\n**source_referer**: Referer source  \ntype: string\n\n**source_referer_domain**: Referer domain  \ntype: string\n\n**utm_source**: UTM source  \ntype: string\n\n**utm_medium**: UTM medium  \ntype: string\n\n**utm_campaign**: UTM campaign  \ntype: string\n\n**utm_term**: UTM term  \ntype: string\n\n**utm_content**: UTM content  \ntype: string\n\n**page**: Page URL  \ntype: url\n\n**page_domain**: Page domain  \ntype: string\n\n**page_title**: Page title  \ntype: string\n\n**entry_page**: Entry page URL  \ntype: url\n\n**exit_page**: Exit page URL  \ntype: url\n\n**continent**: Continent  \ntype: enum (AF \\| AS \\| EU \\| NA \\| OC \\| SA \\| AN \\| )\n\n**country**: Country  \ntype: string\n\n**city**: City  \ntype: string\n\n**browser_language**: Browser language  \ntype: string\n\n**browser**: Browser  \ntype: string\n\n**browser_version**: Browser version  \ntype: string\n\n**os**: Operating system  \ntype: string\n\n**os_version**: Operating system version  \ntype: string\n\n**device**: Device type  \ntype: string\n\n**screensize**: Screen size  \ntype: string\n\n**event_name**: Event name  \ntype: string\n\n**is_external_link_click**: Is external link click  \ntype: boolean\n\n**event_prop:EVENT_PROP**: a custom event property can be specified by its name  \ntype: string\n\nThe following metrics are supported:\n\n**pageviews**: Number of pageview events  \ntype: integer\n\n**visitors**: Number of visitors  \ntype: integer\n\n**visits**: Number of visits  \ntype: integer\n\n**session_bounce_rate**: Session bounce rate (percentage of sessions that triggered only one request)  \ntype: float\n\n**avg_session_length**: Average session length (in seconds)  \ntype: float\n\n**avg_session_duration_sec**: Average session duration (in seconds)  \ntype: integer\n\n**exit_rate**: Exit rate (percentage of pageviews that were the last in the session)  \ntype: float\n\n**exits**: Number of exits  \ntype: integer\n\n**entries**: Number of entries  \ntype: integer\n\n**avg_page_visit_duration_sec**: Average page visit duration (in seconds)  \ntype: integer\n\nFilter is a JSON string that represents a boolean expression, it should follow the following structure:\n```\n<bool_filter> ::= { \"and\" : <bool_filter>+ }\n              |   { \"or\" : <bool_filter>+ }\n              |   { \"not\" : <bool_filter> }\n              |   <expr>\n\n<expr> ::= {\n             \"field\" : <dimension|metric>,\n             ? \"is\": <condition>,\n           }\n\n<condition> ::= [ \"eq\", <value> ]\n            |   [ \"neq\", <value> ]\n            |   [ \"gt\", <value> ]\n            |   [ \"gte\", <value> ]\n            |   [ \"lt\", <value> ]\n            |   [ \"lte\", <value> ]\n            |   [ \"substring\", <value> ]\n            |   [ \"isubstring\", <value> ]\n            |   [ \"phrase_match\", <value> ]\n            |   [ \"iphrase_match\", <value> ]\n            |   [ \"prefix\", <value> ]\n            |   [ \"suffix\", <value> ]\n```"
        required: false
        explode: false
        schema:
          type: string
        name: where
        in: query
      - description: end datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: to
        in: query
      - description: start datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: from
        in: query
      - description: Project ID
        required: true
        explode: false
        schema:
          type: integer
        name: project_id
        in: query
      - $ref: '#/components/parameters/output'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/source-channels'
            application/xml:
              schema:
                $ref: '#/components/schemas/source-channels'
        '400':
          $ref: '#/components/responses/error_400'
        '401':
          $ref: '#/components/responses/error_401'
        '403':
          $ref: '#/components/responses/error_403'
        '429':
          $ref: '#/components/responses/error_429'
        '500':
          $ref: '#/components/responses/error_500'
  /source-channels-chart:
    get:
      tags:
      - Traffic Sources
      summary: Source Channels Chart
      description: '>Requests to this endpoint are free and do not consume any API units.'
      operationId: source-channels-chart
      parameters:
      - description: Specify which values to chart (as a comma separated list), if not provided then `(top5-by-visitors)` is used by default (which charts top 5 values by visitor count).
        required: false
        explode: false
        schema:
          type: string
        name: source_channels_to_chart
        in: query
      - description: "Filter expression. Can mention dimensions and metrics.\n\nThe following dimensions are supported:\n\n**source_channel**: Source Channel  \ntype: enum (search \\| llm \\| email \\| paid \\| search/paid \\| social \\| unknown \\| direct \\| newsletter \\| shopping/organic \\| shopping/paid \\| audio \\| social/paid \\| cross-network \\| mobile-push-notification \\| sms \\| affiliate \\| referral \\| display \\| internal)\n\n**source**: Source  \ntype: string\n\n**source_referer**: Referer source  \ntype: string\n\n**source_referer_domain**: Referer domain  \ntype: string\n\n**utm_source**: UTM source  \ntype: string\n\n**utm_medium**: UTM medium  \ntype: string\n\n**utm_campaign**: UTM campaign  \ntype: string\n\n**utm_term**: UTM term  \ntype: string\n\n**utm_content**: UTM content  \ntype: string\n\n**page**: Page URL  \ntype: url\n\n**page_domain**: Page domain  \ntype: string\n\n**page_title**: Page title  \ntype: string\n\n**entry_page**: Entry page URL  \ntype: url\n\n**exit_page**: Exit page URL  \ntype: url\n\n**continent**: Continent  \ntype: enum (AF \\| AS \\| EU \\| NA \\| OC \\| SA \\| AN \\| )\n\n**country**: Country  \ntype: string\n\n**city**: City  \ntype: string\n\n**browser_language**: Browser language  \ntype: string\n\n**browser**: Browser  \ntype: string\n\n**browser_version**: Browser version  \ntype: string\n\n**os**: Operating system  \ntype: string\n\n**os_version**: Operating system version  \ntype: string\n\n**device**: Device type  \ntype: string\n\n**screensize**: Screen size  \ntype: string\n\n**event_name**: Event name  \ntype: string\n\n**is_external_link_click**: Is external link click  \ntype: boolean\n\n**event_prop:EVENT_PROP**: a custom event property can be specified by its name  \ntype: string\n\nThe following metrics are supported:\n\n**pageviews**: Number of pageview events  \ntype: integer\n\n**visitors**: Number of visitors  \ntype: integer\n\n**visits**: Number of visits  \ntype: integer\n\n**session_bounce_rate**: Session bounce rate (percentage of sessions that triggered only one request)  \ntype: float\n\n**avg_session_length**: Average session length (in seconds)  \ntype: float\n\n**avg_session_duration_sec**: Average session duration (in seconds)  \ntype: integer\n\n**exit_rate**: Exit rate (percentage of pageviews that were the last in the session)  \ntype: float\n\n**exits**: Number of exits  \ntype: integer\n\n**entries**: Number of entries  \ntype: integer\n\n**avg_page_visit_duration_sec**: Average page visit duration (in seconds)  \ntype: integer\n\nFilter is a JSON string that represents a boolean expression, it should follow the following structure:\n```\n<bool_filter> ::= { \"and\" : <bool_filter>+ }\n              |   { \"or\" : <bool_filter>+ }\n              |   { \"not\" : <bool_filter> }\n              |   <expr>\n\n<expr> ::= {\n             \"field\" : <dimension|metric>,\n             ? \"is\": <condition>,\n           }\n\n<condition> ::= [ \"eq\", <value> ]\n            |   [ \"neq\", <value> ]\n            |   [ \"gt\", <value> ]\n            |   [ \"gte\", <value> ]\n            |   [ \"lt\", <value> ]\n            |   [ \"lte\", <value> ]\n            |   [ \"substring\", <value> ]\n            |   [ \"isubstring\", <value> ]\n            |   [ \"phrase_match\", <value> ]\n            |   [ \"iphrase_match\", <value> ]\n            |   [ \"prefix\", <value> ]\n            |   [ \"suffix\", <value> ]\n```"
        required: false
        explode: false
        schema:
          type: string
        name: where
        in: query
      - description: Time granularity for chart data points.
        required: true
        explode: false
        schema:
          type: string
          enum:
          - hourly
          - daily
          - weekly
          - monthly
        name: granularity
        in: query
      - description: end datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: to
        in: query
      - description: start datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: from
        in: query
      - description: Project ID
        required: true
        explode: false
        schema:
          type: integer
        name: project_id
        in: query
      - $ref: '#/components/parameters/output'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/source-channels-chart'
            application/xml:
              schema:
                $ref: '#/components/schemas/source-channels-chart'
        '400':
          $ref: '#/components/responses/error_400'
        '401':
          $ref: '#/components/responses/error_401'
        '403':
          $ref: '#/components/responses/error_403'
        '429':
          $ref: '#/components/responses/error_429'
        '500':
          $ref: '#/components/responses/error_500'
  /sources:
    get:
      tags:
      - Traffic Sources
      summary: Sources
      description: '>Requests to this endpoint are free and do not consume any API units.'
      operationId: sources
      parameters:
      - description: The number of results to return.
        required: false
        explode: false
        schema:
          type: integer
        name: limit
        in: query
      - description: "Order by metric, as `metric:desc` or `metric:asc`. The following metrics are supported:\n\n**pageviews**: Number of pageview events  \ntype: integer\n\n**visitors**: Number of visitors  \ntype: integer\n\n**visits**: Number of visits  \ntype: integer\n\n**session_bounce_rate**: Session bounce rate (percentage of sessions that triggered only one request)  \ntype: float\n\n**avg_session_length**: Average session length (in seconds)  \ntype: float\n\n**avg_session_duration_sec**: Average session duration (in seconds)  \ntype: integer\n\n**exit_rate**: Exit rate (percentage of pageviews that were the last in the session)  \ntype: float\n\n**exits**: Number of exits  \ntype: integer\n\n**entries**: Number of entries  \ntype: integer\n\n**avg_page_visit_duration_sec**: Average page visit duration (in seconds)  \ntype: integer"
        required: false
        explode: false
        schema:
          type: string
        name: order_by
        in: query
      - description: "Filter expression. Can mention dimensions and metrics.\n\nThe following dimensions are supported:\n\n**source_channel**: Source Channel  \ntype: enum (search \\| llm \\| email \\| paid \\| search/paid \\| social \\| unknown \\| direct \\| newsletter \\| shopping/organic \\| shopping/paid \\| audio \\| social/paid \\| cross-network \\| mobile-push-notification \\| sms \\| affiliate \\| referral \\| display \\| internal)\n\n**source**: Source  \ntype: string\n\n**source_referer**: Referer source  \ntype: string\n\n**source_referer_domain**: Referer domain  \ntype: string\n\n**utm_source**: UTM source  \ntype: string\n\n**utm_medium**: UTM medium  \ntype: string\n\n**utm_campaign**: UTM campaign  \ntype: string\n\n**utm_term**: UTM term  \ntype: string\n\n**utm_content**: UTM content  \ntype: string\n\n**page**: Page URL  \ntype: url\n\n**page_domain**: Page domain  \ntype: string\n\n**page_title**: Page title  \ntype: string\n\n**entry_page**: Entry page URL  \ntype: url\n\n**exit_page**: Exit page URL  \ntype: url\n\n**continent**: Continent  \ntype: enum (AF \\| AS \\| EU \\| NA \\| OC \\| SA \\| AN \\| )\n\n**country**: Country  \ntype: string\n\n**city**: City  \ntype: string\n\n**browser_language**: Browser language  \ntype: string\n\n**browser**: Browser  \ntype: string\n\n**browser_version**: Browser version  \ntype: string\n\n**os**: Operating system  \ntype: string\n\n**os_version**: Operating system version  \ntype: string\n\n**device**: Device type  \ntype: string\n\n**screensize**: Screen size  \ntype: string\n\n**event_name**: Event name  \ntype: string\n\n**is_external_link_click**: Is external link click  \ntype: boolean\n\n**event_prop:EVENT_PROP**: a custom event property can be specified by its name  \ntype: string\n\nThe following metrics are supported:\n\n**pageviews**: Number of pageview events  \ntype: integer\n\n**visitors**: Number of visitors  \ntype: integer\n\n**visits**: Number of visits  \ntype: integer\n\n**session_bounce_rate**: Session bounce rate (percentage of sessions that triggered only one request)  \ntype: float\n\n**avg_session_length**: Average session length (in seconds)  \ntype: float\n\n**avg_session_duration_sec**: Average session duration (in seconds)  \ntype: integer\n\n**exit_rate**: Exit rate (percentage of pageviews that were the last in the session)  \ntype: float\n\n**exits**: Number of exits  \ntype: integer\n\n**entries**: Number of entries  \ntype: integer\n\n**avg_page_visit_duration_sec**: Average page visit duration (in seconds)  \ntype: integer\n\nFilter is a JSON string that represents a boolean expression, it should follow the following structure:\n```\n<bool_filter> ::= { \"and\" : <bool_filter>+ }\n              |   { \"or\" : <bool_filter>+ }\n              |   { \"not\" : <bool_filter> }\n              |   <expr>\n\n<expr> ::= {\n             \"field\" : <dimension|metric>,\n             ? \"is\": <condition>,\n           }\n\n<condition> ::= [ \"eq\", <value> ]\n            |   [ \"neq\", <value> ]\n            |   [ \"gt\", <value> ]\n            |   [ \"gte\", <value> ]\n            |   [ \"lt\", <value> ]\n            |   [ \"lte\", <value> ]\n            |   [ \"substring\", <value> ]\n            |   [ \"isubstring\", <value> ]\n            |   [ \"phrase_match\", <value> ]\n            |   [ \"iphrase_match\", <value> ]\n            |   [ \"prefix\", <value> ]\n            |   [ \"suffix\", <value> ]\n```"
        required: false
        explode: false
        schema:
          type: string
        name: where
        in: query
      - description: end datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: to
        in: query
      - description: start datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: from
        in: query
      - description: Project ID
        required: true
        explode: false
        schema:
          type: integer
        name: project_id
        in: query
      - $ref: '#/components/parameters/output'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/sources'
            application/xml:
              schema:
                $ref: '#/components/schemas/sources'
        '400':
          $ref: '#/components/responses/error_400'
        '401':
          $ref: '#/components/responses/error_401'
        '403':
          $ref: '#/components/responses/error_403'
        '429':
          $ref: '#/components/responses/error_429'
        '500':
          $ref: '#/components/responses/error_500'
  /sources-chart:
    get:
      tags:
      - Traffic Sources
      summary: Sources Chart
      description: '>Requests to this endpoint are free and do not consume any API units.'
      operationId: sources-chart
      parameters:
      - description: Specify which values to chart (as a comma separated list), if not provided then `(top5-by-visitors)` is used by default (which charts top 5 values by visitor count).
        required: false
        explode: false
        schema:
          type: string
        name: sources_to_chart
        in: query
      - description: "Filter expression. Can mention dimensions and metrics.\n\nThe following dimensions are supported:\n\n**source_channel**: Source Channel  \ntype: enum (search \\| llm \\| email \\| paid \\| search/paid \\| social \\| unknown \\| direct \\| newsletter \\| shopping/organic \\| shopping/paid \\| audio \\| social/paid \\| cross-network \\| mobile-push-notification \\| sms \\| affiliate \\| referral \\| display \\| internal)\n\n**source**: Source  \ntype: string\n\n**source_referer**: Referer source  \ntype: string\n\n**source_referer_domain**: Referer domain  \ntype: string\n\n**utm_source**: UTM source  \ntype: string\n\n**utm_medium**: UTM medium  \ntype: string\n\n**utm_campaign**: UTM campaign  \ntype: string\n\n**utm_term**: UTM term  \ntype: string\n\n**utm_content**: UTM content  \ntype: string\n\n**page**: Page URL  \ntype: url\n\n**page_domain**: Page domain  \ntype: string\n\n**page_title**: Page title  \ntype: string\n\n**entry_page**: Entry page URL  \ntype: url\n\n**exit_page**: Exit page URL  \ntype: url\n\n**continent**: Continent  \ntype: enum (AF \\| AS \\| EU \\| NA \\| OC \\| SA \\| AN \\| )\n\n**country**: Country  \ntype: string\n\n**city**: City  \ntype: string\n\n**browser_language**: Browser language  \ntype: string\n\n**browser**: Browser  \ntype: string\n\n**browser_version**: Browser version  \ntype: string\n\n**os**: Operating system  \ntype: string\n\n**os_version**: Operating system version  \ntype: string\n\n**device**: Device type  \ntype: string\n\n**screensize**: Screen size  \ntype: string\n\n**event_name**: Event name  \ntype: string\n\n**is_external_link_click**: Is external link click  \ntype: boolean\n\n**event_prop:EVENT_PROP**: a custom event property can be specified by its name  \ntype: string\n\nThe following metrics are supported:\n\n**pageviews**: Number of pageview events  \ntype: integer\n\n**visitors**: Number of visitors  \ntype: integer\n\n**visits**: Number of visits  \ntype: integer\n\n**session_bounce_rate**: Session bounce rate (percentage of sessions that triggered only one request)  \ntype: float\n\n**avg_session_length**: Average session length (in seconds)  \ntype: float\n\n**avg_session_duration_sec**: Average session duration (in seconds)  \ntype: integer\n\n**exit_rate**: Exit rate (percentage of pageviews that were the last in the session)  \ntype: float\n\n**exits**: Number of exits  \ntype: integer\n\n**entries**: Number of entries  \ntype: integer\n\n**avg_page_visit_duration_sec**: Average page visit duration (in seconds)  \ntype: integer\n\nFilter is a JSON string that represents a boolean expression, it should follow the following structure:\n```\n<bool_filter> ::= { \"and\" : <bool_filter>+ }\n              |   { \"or\" : <bool_filter>+ }\n              |   { \"not\" : <bool_filter> }\n              |   <expr>\n\n<expr> ::= {\n             \"field\" : <dimension|metric>,\n             ? \"is\": <condition>,\n           }\n\n<condition> ::= [ \"eq\", <value> ]\n            |   [ \"neq\", <value> ]\n            |   [ \"gt\", <value> ]\n            |   [ \"gte\", <value> ]\n            |   [ \"lt\", <value> ]\n            |   [ \"lte\", <value> ]\n            |   [ \"substring\", <value> ]\n            |   [ \"isubstring\", <value> ]\n            |   [ \"phrase_match\", <value> ]\n            |   [ \"iphrase_match\", <value> ]\n            |   [ \"prefix\", <value> ]\n            |   [ \"suffix\", <value> ]\n```"
        required: false
        explode: false
        schema:
          type: string
        name: where
        in: query
      - description: Time granularity for chart data points.
        required: true
        explode: false
        schema:
          type: string
          enum:
          - hourly
          - daily
          - weekly
          - monthly
        name: granularity
        in: query
      - description: end datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: to
        in: query
      - description: start datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: from
        in: query
      - description: Project ID
        required: true
        explode: false
        schema:
          type: integer
        name: project_id
        in: query
      - $ref: '#/components/parameters/output'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/sources-chart'
            application/xml:
              schema:
                $ref: '#/components/schemas/sources-chart'
        '400':
          $ref: '#/components/responses/error_400'
        '401':
          $ref: '#/components/responses/error_401'
        '403':
          $ref: '#/components/responses/error_403'
        '429':
          $ref: '#/components/responses/error_429'
        '500':
          $ref: '#/components/responses/error_500'
  /referrers:
    get:
      tags:
      - Traffic Sources
      summary: Referrers
      description: '>Requests to this endpoint are free and do not consume any API units.'
      operationId: referrers
      parameters:
      - description: The number of results to return.
        required: false
        explode: false
        schema:
          type: integer
        name: limit
        in: query
      - description: "Order by metric, as `metric:desc` or `metric:asc`. The following metrics are supported:\n\n**pageviews**: Number of pageview events  \ntype: integer\n\n**visitors**: Number of visitors  \ntype: integer\n\n**visits**: Number of visits  \ntype: integer\n\n**session_bounce_rate**: Session bounce rate (percentage of sessions that triggered only one request)  \ntype: float\n\n**avg_session_length**: Average session length (in seconds)  \ntype: float\n\n**avg_session_duration_sec**: Average session duration (in seconds)  \ntype: integer\n\n**exit_rate**: Exit rate (percentage of pageviews that were the last in the session)  \ntype: float\n\n**exits**: Number of exits  \ntype: integer\n\n**entries**: Number of entries  \ntype: integer\n\n**avg_page_visit_duration_sec**: Average page visit duration (in seconds)  \ntype: integer"
        required: false
        explode: false
        schema:
          type: string
        name: order_by
        in: query
      - description: "Filter expression. Can mention dimensions and metrics.\n\nThe following dimensions are supported:\n\n**source_channel**: Source Channel  \ntype: enum (search \\| llm \\| email \\| paid \\| search/paid \\| social \\| unknown \\| direct \\| newsletter \\| shopping/organic \\| shopping/paid \\| audio \\| social/paid \\| cross-network \\| mobile-push-notification \\| sms \\| affiliate \\| referral \\| display \\| internal)\n\n**source**: Source  \ntype: string\n\n**source_referer**: Referer source  \ntype: string\n\n**source_referer_domain**: Referer domain  \ntype: string\n\n**utm_source**: UTM source  \ntype: string\n\n**utm_medium**: UTM medium  \ntype: string\n\n**utm_campaign**: UTM campaign  \ntype: string\n\n**utm_term**: UTM term  \ntype: string\n\n**utm_content**: UTM content  \ntype: string\n\n**page**: Page URL  \ntype: url\n\n**page_domain**: Page domain  \ntype: string\n\n**page_title**: Page title  \ntype: string\n\n**entry_page**: Entry page URL  \ntype: url\n\n**exit_page**: Exit page URL  \ntype: url\n\n**continent**: Continent  \ntype: enum (AF \\| AS \\| EU \\| NA \\| OC \\| SA \\| AN \\| )\n\n**country**: Country  \ntype: string\n\n**city**: City  \ntype: string\n\n**browser_language**: Browser language  \ntype: string\n\n**browser**: Browser  \ntype: string\n\n**browser_version**: Browser version  \ntype: string\n\n**os**: Operating system  \ntype: string\n\n**os_version**: Operating system version  \ntype: string\n\n**device**: Device type  \ntype: string\n\n**screensize**: Screen size  \ntype: string\n\n**event_name**: Event name  \ntype: string\n\n**is_external_link_click**: Is external link click  \ntype: boolean\n\n**event_prop:EVENT_PROP**: a custom event property can be specified by its name  \ntype: string\n\nThe following metrics are supported:\n\n**pageviews**: Number of pageview events  \ntype: integer\n\n**visitors**: Number of visitors  \ntype: integer\n\n**visits**: Number of visits  \ntype: integer\n\n**session_bounce_rate**: Session bounce rate (percentage of sessions that triggered only one request)  \ntype: float\n\n**avg_session_length**: Average session length (in seconds)  \ntype: float\n\n**avg_session_duration_sec**: Average session duration (in seconds)  \ntype: integer\n\n**exit_rate**: Exit rate (percentage of pageviews that were the last in the session)  \ntype: float\n\n**exits**: Number of exits  \ntype: integer\n\n**entries**: Number of entries  \ntype: integer\n\n**avg_page_visit_duration_sec**: Average page visit duration (in seconds)  \ntype: integer\n\nFilter is a JSON string that represents a boolean expression, it should follow the following structure:\n```\n<bool_filter> ::= { \"and\" : <bool_filter>+ }\n              |   { \"or\" : <bool_filter>+ }\n              |   { \"not\" : <bool_filter> }\n              |   <expr>\n\n<expr> ::= {\n             \"field\" : <dimension|metric>,\n             ? \"is\": <condition>,\n           }\n\n<condition> ::= [ \"eq\", <value> ]\n            |   [ \"neq\", <value> ]\n            |   [ \"gt\", <value> ]\n            |   [ \"gte\", <value> ]\n            |   [ \"lt\", <value> ]\n            |   [ \"lte\", <value> ]\n            |   [ \"substring\", <value> ]\n            |   [ \"isubstring\", <value> ]\n            |   [ \"phrase_match\", <value> ]\n            |   [ \"iphrase_match\", <value> ]\n            |   [ \"prefix\", <value> ]\n            |   [ \"suffix\", <value> ]\n```"
        required: false
        explode: false
        schema:
          type: string
        name: where
        in: query
      - description: end datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: to
        in: query
      - description: start datetime for the data query
        required: false
        explode: false
        schema:
          type: string
          format: date-time
        name: from
        in: query
      - description: Project ID
        required: true
        explode: false
        schema:
          type: integer
        name: project_id
        in: query
      - $ref: '#/components/parameters/output'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/referrers'
            application/xml:
              schema:
                $ref: '#/components/schemas/referrers'
        '400':
          $ref: '#/components/responses/error_400'
        '401':
          $ref: '#/components/responses/error_401'
        '403':
          $ref: '#/components/responses/error_403'
        '429':
          $ref: '#/components/responses/error_429'
        '500':
          $ref: '#/components/responses/error_500'
  /referrers-chart:
    get:
      tags:
      - Traffic Sources
      summary: Referrers Chart
      description: '>Requests to this endpoint are free and do not consume any API units.'
      operationId: referrers-chart
      parameters:
      - description: Specify which values to chart (as a comma separated list), if not provided then `(top5-by-visitors)` is used by default (which charts top 5 values by visitor count).
        required: false
        explode: false
        schema:
          type: string
        name: source_referers_to_chart
        in: query
      - description: "Filter expression. Can mention dimensions and metrics.\n\nThe following dimensions are supported:\n\n**source_channel**: Source Channel  \ntype: enum (search \\| llm \\| email \\| paid \\| search/paid \\| social \\| unknown \\| direct \\| newsletter \\| shopping/organic \\| shopping/paid \\| audio \\| social/paid \\| cross-network \\| mobile-push-notification \\| sms \\| affiliate \\| referral \\| display \\| internal)\n\n**source**: Source  \ntype: string\n\n**source_referer**: Referer source  \ntype: string\n\n**source_referer_domain**: Referer domain  \ntype: string\n\n**utm_source**: UTM source  \ntype: string\n\n**utm_medium**: UTM medium  \ntype: string\n\n**utm_campaign**: UTM campaign  \ntype: string\n\n**utm_term**: UTM term  \ntype: string\n\n**utm_content**: UTM content  \ntype: string\n\n**page**: Page URL  \ntype: url\n\n**page_domain**: Page domain  \ntype: string\n\n**page_title**: Page title  \ntype: string\n\n**entry_page**: Entry page URL  \ntype: url\n\n**exit_page**: Exit page URL  \ntype: url\n\n**continent**: Continent  \ntype: enum (AF \\| AS \\| EU \\| NA \\| OC \\| SA \\| AN \\| )\n\n**country**: Country  \ntype: string\n\n**city**: City  \ntype: string\n\n**browser_language**: Browser language  \ntype: string\n\n**browser**: Browser  \ntype: string\n\n**browser_version**: Browser version  \ntype: string\n\n**os**: Operating system  \ntype: string\n\n**os_version**: Operating system version  \ntype: string\n\n**device**: Device type  \ntype: string\n\n**screensize**: Screen size  \ntype: string\n\n**event_name**: Event name  \ntype: string\n\n**is_external_link_click**: Is external link click  \ntype: boolean\n\n**event_prop:EVENT_PROP**: a custom event property can be specified by its name  \ntype: string\n\nThe followi

# --- truncated at 32 KB (58 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/ahrefs/refs/heads/main/openapi/ahrefs-traffic-sources-api-openapi.yml