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

# Export cost per earned conversion by channel

> Export the MCP CAC read with basis_note and stored spend. Account selection restricts claims and spend; earned counts cover the workspace.



## OpenAPI

````yaml https://plainrouter.com/openapi.json get /workspaces/{workspace}/admin/cac-by-channel
openapi: 3.1.0
info:
  title: Plainrouter Conversion API
  version: 0.5.0
  description: Plainrouter public Signals Conversion API.
servers:
  - url: https://plainrouter.com/api/v1
    description: Production
security:
  - workspaceSecret: []
paths:
  /workspaces/{workspace}/admin/cac-by-channel:
    get:
      tags:
        - SignalsExport
      summary: Export cost per earned conversion by channel
      description: >-
        Export the MCP CAC read with basis_note and stored spend. Account
        selection restricts claims and spend; earned counts cover the workspace.
      operationId: get_cac_by_channel
      parameters:
        - name: workspace
          in: path
          required: true
          description: The workspace ID
          schema:
            type: integer
        - name: account_id
          in: query
          description: >-
            Optional advertising account selector, restricted to the workspace
            and key binding. An account outside either returns 404.
          schema:
            minimum: 1
            type: integer
        - name: from
          in: query
          description: >-
            Inclusive conversion time; defaults to 30 days before to. Retention
            applies.
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: to
          in: query
          description: Inclusive conversion time; defaults to now.
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: model
          in: query
          description: Journey credit model.
          schema:
            type: string
            enum:
              - position_based
              - first
              - last
              - linear
            default: position_based
        - name: lookback
          in: query
          description: Maximum touch age before conversion, in days.
          schema:
            type: integer
            enum:
              - 7
              - 30
              - 60
              - 90
            default: 90
        - name: level
          in: query
          description: Channel dimension.
          schema:
            type: string
            enum:
              - platform
              - campaign_id
              - ad_set_id
              - ad_id
              - utm_source
              - utm_medium
              - utm_campaign
            default: platform
        - name: conversion_kind
          in: query
          description: Conversion stage to count.
          schema:
            type: string
            enum:
              - subscribed
              - purchase
              - trial_started
            default: subscribed
      responses:
        '200':
          description: The same public read as the MCP tool, including basis_note.
          content:
            application/json:
              schema:
                type: object
                properties:
                  coverage:
                    type: object
                    description: >-
                      The same coverage block as MCP: YYYY-MM-DD dates in
                      timezone for Meta and UTC for counted/revenue starts,
                      nulls with reasons, a maximum of 31 unread dates with
                      their full count, and a separate seven-complete-day
                      untagged-spend window; the block names its account and the
                      other read accounts it does not cover, and revenue starts
                      use stored webhook and active connection records clamped
                      to retention; null basis points mean unknown.
                    properties:
                      kept_from:
                        type: string
                      timezone:
                        type: string
                      record_starts:
                        type: object
                        properties:
                          counted:
                            type: object
                            properties:
                              date:
                                type:
                                  - string
                                  - 'null'
                              reason:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - date
                              - reason
                          meta_spend:
                            type: object
                            properties:
                              date:
                                type:
                                  - string
                                  - 'null'
                              reason:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - date
                              - reason
                          meta_changes:
                            type: object
                            properties:
                              date:
                                type:
                                  - string
                                  - 'null'
                              reason:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - date
                              - reason
                          revenue:
                            type:
                              - object
                              - 'null'
                            properties:
                              date:
                                type:
                                  - string
                                  - 'null'
                              reason:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - date
                              - reason
                        required:
                          - counted
                          - meta_spend
                          - meta_changes
                          - revenue
                      meta:
                        type:
                          - object
                          - 'null'
                        properties:
                          account_id:
                            type: integer
                          other_account_ids:
                            type: array
                            items:
                              type: integer
                          note:
                            type: string
                          revisable:
                            type: object
                            properties:
                              from:
                                type: string
                              to:
                                type: string
                            required:
                              - from
                              - to
                          unread_days:
                            type: object
                            properties:
                              dates:
                                type: array
                                items:
                                  type: string
                              count:
                                type: integer
                              capped:
                                type: boolean
                            required:
                              - dates
                              - count
                              - capped
                          activity:
                            type:
                              - object
                              - 'null'
                            properties:
                              last_error_code:
                                type:
                                  - string
                                  - 'null'
                              gap_window:
                                type:
                                  - object
                                  - 'null'
                                properties:
                                  from:
                                    type: string
                                  to:
                                    type: string
                                required:
                                  - from
                                  - to
                            required:
                              - last_error_code
                              - gap_window
                          untagged_spend:
                            type: object
                            properties:
                              basis_points:
                                type:
                                  - integer
                                  - 'null'
                              reason:
                                type:
                                  - string
                                  - 'null'
                              window:
                                type: object
                                properties:
                                  from:
                                    type: string
                                  to:
                                    type: string
                                  timezone:
                                    type: string
                                required:
                                  - from
                                  - to
                                  - timezone
                              note:
                                type: string
                            required:
                              - basis_points
                              - reason
                              - window
                              - note
                        required:
                          - account_id
                          - other_account_ids
                          - note
                          - revisable
                          - unread_days
                          - activity
                          - untagged_spend
                      meta_reason:
                        type:
                          - string
                          - 'null'
                      not_recorded:
                        type: array
                        items:
                          type: string
                      note:
                        type: string
                    required:
                      - kept_from
                      - timezone
                      - record_starts
                      - meta
                      - meta_reason
                      - not_recorded
                      - note
                  basis_note:
                    type: string
                    description: >-
                      Explains the different counting bases; returned verbatim
                      from the MCP read.
                  range_used:
                    type: object
                    properties:
                      from:
                        type: string
                      to:
                        type: string
                    required:
                      - from
                      - to
                  model:
                    type: string
                  lookback:
                    type: integer
                  level:
                    type: string
                  conversion_kind:
                    type: string
                  conversion_date_basis:
                    type: string
                  spend_date_basis:
                    type: string
                  date_alignment:
                    type: string
                  channels:
                    type: array
                    items:
                      type: object
                      properties:
                        value:
                          anyOf:
                            - type: string
                            - type: integer
                            - type: 'null'
                        appeared_in:
                          type: integer
                        earned:
                          type: string
                        earned_value:
                          anyOf:
                            - type: object
                              additionalProperties:
                                type: string
                            - type: array
                              items:
                                type: string
                        basis_note:
                          type: string
                        claimed_purchases:
                          type:
                            - string
                            - 'null'
                        claimed_value:
                          anyOf:
                            - type: object
                              additionalProperties:
                                type: string
                            - type: array
                              items:
                                type: string
                            - type: 'null'
                        claimed_unavailable_reason:
                          type:
                            - string
                            - 'null'
                        meta_claim_account_ids:
                          type: array
                          items:
                            type: integer
                        meta_attribution_settings:
                          type:
                            - array
                            - 'null'
                          items:
                            type: string
                        meta_attribution_unavailable_reason:
                          type:
                            - string
                            - 'null'
                        spend:
                          type:
                            - array
                            - 'null'
                          items:
                            type: object
                            properties:
                              currency:
                                type: string
                              amount:
                                type: string
                              source_table:
                                type: string
                              latest_spend_date:
                                type:
                                  - string
                                  - 'null'
                              platform_ad_account_ids:
                                type: array
                                items:
                                  type: integer
                              cac:
                                type:
                                  - string
                                  - 'null'
                              cac_unavailable_reason:
                                type:
                                  - string
                                  - 'null'
                              claimed_cost_per_result:
                                type:
                                  - string
                                  - 'null'
                              claimed_cost_unavailable_reason:
                                type:
                                  - string
                                  - 'null'
                              claimed_cost_label:
                                type: string
                              basis_note:
                                type: string
                            required:
                              - currency
                              - amount
                              - source_table
                              - latest_spend_date
                              - platform_ad_account_ids
                              - cac
                              - cac_unavailable_reason
                        spend_unavailable_reason:
                          type:
                            - string
                            - 'null'
                        spend_coverage:
                          type: object
                          properties:
                            complete:
                              type: boolean
                            accounts_excluded:
                              type: object
                              properties:
                                scope:
                                  type: integer
                                inactive:
                                  type: integer
                                disconnected:
                                  type: integer
                              required:
                                - scope
                                - inactive
                                - disconnected
                            excluded_account_count:
                              type: integer
                          required:
                            - complete
                            - accounts_excluded
                            - excluded_account_count
                        spend_cac_unavailable_reason:
                          type: string
                        cac:
                          type:
                            - object
                            - 'null'
                          additionalProperties:
                            type:
                              - string
                              - 'null'
                        cac_unavailable_reason:
                          type:
                            - string
                            - 'null'
                        claimed_cost_per_result:
                          anyOf:
                            - type: object
                              additionalProperties:
                                type:
                                  - string
                                  - 'null'
                            - type: string
                            - type: 'null'
                        claimed_cost_unavailable_reason:
                          type:
                            - string
                            - 'null'
                        claimed_cost_label:
                          type: string
                      required:
                        - value
                        - appeared_in
                        - earned
                        - earned_value
                        - basis_note
                        - claimed_purchases
                        - claimed_value
                        - claimed_unavailable_reason
                        - meta_claim_account_ids
                        - meta_attribution_settings
                        - meta_attribution_unavailable_reason
                        - spend
                        - spend_unavailable_reason
                        - spend_coverage
                        - cac
                        - cac_unavailable_reason
                  totals:
                    type: object
                    properties:
                      earned:
                        type: string
                      spend_by_currency:
                        type: object
                        additionalProperties:
                          type: string
                    required:
                      - earned
                      - spend_by_currency
                  spend:
                    type: object
                    properties:
                      basis:
                        type: string
                      alignment:
                        type: string
                      sources:
                        type: array
                        items:
                          type: string
                      accounts:
                        type: array
                        items:
                          type: object
                          properties:
                            platform_ad_account_id:
                              type: integer
                            platform:
                              type: string
                            timezone:
                              type:
                                - string
                                - 'null'
                            reporting_date_range:
                              type:
                                - object
                                - 'null'
                              properties:
                                from:
                                  type: string
                                to:
                                  type: string
                                inclusive:
                                  type: boolean
                                days:
                                  type: integer
                              required:
                                - from
                                - to
                                - inclusive
                                - days
                            latest_spend_date:
                              type:
                                - string
                                - 'null'
                            earliest_spend_date:
                              type:
                                - string
                                - 'null'
                            spend_days:
                              type: integer
                            source_table:
                              type:
                                - string
                                - 'null'
                            unavailable_reason:
                              type:
                                - string
                                - 'null'
                          required:
                            - platform_ad_account_id
                            - platform
                            - timezone
                            - reporting_date_range
                            - latest_spend_date
                            - earliest_spend_date
                            - spend_days
                            - source_table
                            - unavailable_reason
                      totals:
                        type: array
                        items:
                          type: object
                          properties:
                            currency:
                              type: string
                            amount:
                              type: string
                            latest_spend_date:
                              type:
                                - string
                                - 'null'
                            source_tables:
                              type: array
                              items:
                                type: string
                          required:
                            - currency
                            - amount
                            - latest_spend_date
                            - source_tables
                    required:
                      - basis
                      - alignment
                      - sources
                      - accounts
                      - totals
                  meta_claims:
                    type: object
                    properties:
                      basis_note:
                        type: string
                      label:
                        type: string
                      basis:
                        type: string
                      accounts:
                        type: array
                        items:
                          type: object
                          properties:
                            platform_ad_account_id:
                              type: integer
                            timezone:
                              type:
                                - string
                                - 'null'
                            reporting_date_range:
                              type:
                                - object
                                - 'null'
                              properties:
                                from:
                                  type: string
                                to:
                                  type: string
                                inclusive:
                                  type: boolean
                              required:
                                - from
                                - to
                                - inclusive
                            claimed_purchases:
                              type:
                                - string
                                - 'null'
                            claimed_value:
                              anyOf:
                                - type: object
                                  additionalProperties:
                                    type: string
                                - type: array
                                  items:
                                    type: string
                                - type: 'null'
                            claimed_value_reason:
                              type: string
                            attribution_settings:
                              type: array
                              items:
                                type: string
                            stored_days:
                              type: integer
                            unavailable_reason:
                              type:
                                - string
                                - 'null'
                          required:
                            - platform_ad_account_id
                            - timezone
                            - reporting_date_range
                            - claimed_purchases
                            - claimed_value
                            - claimed_value_reason
                            - attribution_settings
                            - stored_days
                            - unavailable_reason
                    required:
                      - basis_note
                      - label
                      - basis
                      - accounts
                required:
                  - coverage
                  - basis_note
                  - range_used
                  - model
                  - lookback
                  - level
                  - conversion_kind
                  - conversion_date_basis
                  - spend_date_basis
                  - date_alignment
                  - channels
                  - totals
                  - spend
                  - meta_claims
        '401':
          description: >-
            Workspace read key missing, revoked, expired or no longer valid for
            its issuer.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: >-
            The key lacks the operation scope, ability or current workspace
            role.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Workspace or account not found or outside the key binding.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ErrorMessage'
                  - $ref: '#/components/schemas/ApiRouteNotFound'
        '422':
          description: Invalid input or journey continuation cursor.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
      security:
        - workspaceExportKey: []
components:
  schemas:
    ErrorMessage:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: ErrorMessage
    ApiRouteNotFound:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - api_route_not_found
            message:
              type: string
            resolution:
              type: string
          required:
            - code
            - message
            - resolution
        request:
          type: object
          properties:
            method:
              type: string
            path:
              type: string
          required:
            - method
            - path
        resources:
          type: object
          properties:
            documentation:
              type: string
            openapi:
              type: string
          required:
            - documentation
            - openapi
      required:
        - error
        - request
        - resources
      title: ApiRouteNotFound
    ValidationError:
      type: object
      properties:
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      required:
        - message
        - errors
      title: ValidationError
  securitySchemes:
    workspaceSecret:
      type: http
      description: >-
        Per-workspace Server secret. It authenticates only the Signals workspace
        represented by the credential.
      scheme: bearer
    workspaceExportKey:
      type: http
      description: >-
        Workspace read key whose stored grant explicitly names the operation.
        Existing grants are not expanded.
      scheme: bearer

````

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