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

# Get ad campaign tree

> Returns campaigns, ad sets, and ads as a provider tree.



## OpenAPI

````yaml /api/openapi.json get /v1/ads/tree
openapi: 3.1.0
info:
  title: Kavenio API
  version: 1.0.0
  license:
    name: Proprietary
    url: https://kavenio.com/terms
  description: Generated OpenAPI document for the stable Kavenio public API.
servers:
  - url: https://api.kavenio.com
security:
  - bearerAuth: []
tags:
  - name: API keys
    description: Manage Kavenio API keys for the authenticated user.
  - name: Integrations
    description: Connect automation clients and manage workflow subscriptions.
  - name: Feature requests
    description: Submit feature requests from authenticated users.
  - name: Posts
    description: Create, schedule, update, and manage post lifecycle actions.
  - name: Queue
    description: Manage reusable post queue schedules and preview slots.
  - name: Media
    description: Upload, presign, and validate media assets.
  - name: Validation
    description: Validate post payloads and platform content length limits.
  - name: Connect
    description: Start and complete account connection flows.
  - name: Accounts
    description: Manage connected social accounts and account health.
  - name: Telegram
    description: Manage Telegram-specific connected account settings.
  - name: Discord
    description: Manage Discord messages, roles, pins, events, and settings.
  - name: Google Business
    description: Manage Google Business locations, reviews, and helpers.
  - name: Ads
    description: Create, read, cancel, and inspect advertising resources.
  - name: Ad audiences
    description: Manage advertising audiences and audience members.
  - name: Ad catalogs
    description: Inspect advertising catalogs and product sets.
  - name: Ad targeting
    description: Search targeting entities and estimate audience reach.
  - name: Ad conversions
    description: Manage conversion destinations and send conversion events.
  - name: Ad leads
    description: Manage lead forms and retrieve advertising leads.
  - name: Tracking tags
    description: Manage Meta tracking tags and tag sharing.
  - name: Platform credentials
    description: Manage organization platform app credentials.
  - name: Analytics
    description: Read provider analytics and operational inbox data.
  - name: WhatsApp conversions
    description: Read and send WhatsApp conversion events.
  - name: Activity
    description: Read operational activity events.
  - name: Webhooks
    description: Manage webhook endpoints and delivery logs.
paths:
  /v1/ads/tree:
    get:
      tags:
        - Ads
      summary: Get ad campaign tree
      description: Returns campaigns, ad sets, and ads as a provider tree.
      operationId: getAdCampaignTree
      parameters:
        - in: query
          name: page
          schema:
            type: integer
            minimum: 1
            maximum: 9007199254740991
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 100
        - in: query
          name: source
          schema:
            type: string
            enum:
              - zernio
              - all
        - in: query
          name: platform
          schema:
            type: string
            enum:
              - facebook
              - instagram
              - tiktok
              - linkedin
              - pinterest
              - google
              - twitter
        - in: query
          name: status
          schema:
            type: string
            enum:
              - active
              - paused
              - pending_review
              - rejected
              - completed
              - cancelled
              - error
        - in: query
          name: adAccountId
          schema:
            type: string
            minLength: 1
        - in: query
          name: accountId
          schema:
            type: string
            minLength: 16
            maxLength: 16
            pattern: ^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]{16}$
        - in: query
          name: profileId
          schema:
            type: string
            minLength: 1
            maxLength: 255
        - in: query
          name: fromDate
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
        - in: query
          name: toDate
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
      responses:
        '200':
          description: Get ad campaign tree completed.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      ok:
                        type: boolean
                        x-kavenio-const: true
                      data:
                        type: object
                        properties:
                          campaigns:
                            type: array
                            items:
                              type: object
                              properties:
                                platformCampaignId:
                                  type: string
                                  minLength: 1
                                platform:
                                  type: string
                                  enum:
                                    - facebook
                                    - instagram
                                    - tiktok
                                    - linkedin
                                    - pinterest
                                    - google
                                    - twitter
                                campaignName:
                                  type: string
                                  minLength: 1
                                status:
                                  type: string
                                  enum:
                                    - active
                                    - paused
                                    - pending_review
                                    - rejected
                                    - completed
                                    - cancelled
                                    - error
                                reviewStatus:
                                  type: string
                                  minLength: 1
                                platformCampaignStatus:
                                  type: string
                                  minLength: 1
                                campaignIssuesInfo:
                                  type: array
                                  items:
                                    type: object
                                    propertyNames:
                                      type: string
                                    additionalProperties: {}
                                adCount:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                budget:
                                  type: object
                                  properties:
                                    amount:
                                      type: number
                                    type:
                                      type: string
                                      minLength: 1
                                  required:
                                    - amount
                                    - type
                                  additionalProperties: false
                                campaignBudget:
                                  type: object
                                  properties:
                                    amount:
                                      type: number
                                    type:
                                      type: string
                                      minLength: 1
                                  required:
                                    - amount
                                    - type
                                  additionalProperties: false
                                budgetLevel:
                                  type: string
                                  minLength: 1
                                isBudgetScheduleEnabled:
                                  type: boolean
                                currency:
                                  type: string
                                  minLength: 1
                                metrics:
                                  type: object
                                  properties:
                                    spend:
                                      type: number
                                    impressions:
                                      type: number
                                    reach:
                                      type: number
                                    clicks:
                                      type: number
                                    ctr:
                                      type: number
                                    cpc:
                                      type: number
                                    cpm:
                                      type: number
                                    engagement:
                                      type: number
                                    conversions:
                                      type: number
                                    costPerConversion:
                                      type: number
                                    actions:
                                      type: object
                                      propertyNames:
                                        type: string
                                      additionalProperties:
                                        type: number
                                    actionValues:
                                      type: object
                                      propertyNames:
                                        type: string
                                      additionalProperties:
                                        type: number
                                    purchaseValue:
                                      type: number
                                    roas:
                                      type: number
                                    lastSyncedAt:
                                      type: string
                                      minLength: 1
                                  required:
                                    - spend
                                    - impressions
                                    - reach
                                    - clicks
                                    - ctr
                                    - cpc
                                    - cpm
                                    - engagement
                                    - conversions
                                    - costPerConversion
                                    - actions
                                    - actionValues
                                    - purchaseValue
                                    - roas
                                  additionalProperties: false
                                platformAdAccountId:
                                  type: string
                                  minLength: 1
                                platformAdAccountName:
                                  type: string
                                  minLength: 1
                                accountId:
                                  type: string
                                  minLength: 1
                                profileId:
                                  type: string
                                  minLength: 1
                                platformObjective:
                                  type: string
                                  minLength: 1
                                optimizationGoal:
                                  type: string
                                  minLength: 1
                                bidStrategy:
                                  type: string
                                  minLength: 1
                                bidAmount:
                                  type: number
                                roasAverageFloor:
                                  type: number
                                promotedObject:
                                  type: object
                                  propertyNames:
                                    type: string
                                  additionalProperties: {}
                                earliestAd:
                                  type: string
                                  minLength: 1
                                latestAd:
                                  type: string
                                  minLength: 1
                                adSetCount:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                adSets:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      platformAdSetId:
                                        type: string
                                        minLength: 1
                                      adSetName:
                                        type: string
                                        minLength: 1
                                      status:
                                        type: string
                                        enum:
                                          - active
                                          - paused
                                          - pending_review
                                          - rejected
                                          - completed
                                          - cancelled
                                          - error
                                      adCount:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      budget:
                                        type: object
                                        properties:
                                          amount:
                                            type: number
                                          type:
                                            type: string
                                            minLength: 1
                                        required:
                                          - amount
                                          - type
                                        additionalProperties: false
                                      adSetBudget:
                                        type: object
                                        properties:
                                          amount:
                                            type: number
                                          type:
                                            type: string
                                            minLength: 1
                                        required:
                                          - amount
                                          - type
                                        additionalProperties: false
                                      metrics:
                                        type: object
                                        properties:
                                          spend:
                                            type: number
                                          impressions:
                                            type: number
                                          reach:
                                            type: number
                                          clicks:
                                            type: number
                                          ctr:
                                            type: number
                                          cpc:
                                            type: number
                                          cpm:
                                            type: number
                                          engagement:
                                            type: number
                                          conversions:
                                            type: number
                                          costPerConversion:
                                            type: number
                                          actions:
                                            type: object
                                            propertyNames:
                                              type: string
                                            additionalProperties:
                                              type: number
                                          actionValues:
                                            type: object
                                            propertyNames:
                                              type: string
                                            additionalProperties:
                                              type: number
                                          purchaseValue:
                                            type: number
                                          roas:
                                            type: number
                                          lastSyncedAt:
                                            type: string
                                            minLength: 1
                                        required:
                                          - spend
                                          - impressions
                                          - reach
                                          - clicks
                                          - ctr
                                          - cpc
                                          - cpm
                                          - engagement
                                          - conversions
                                          - costPerConversion
                                          - actions
                                          - actionValues
                                          - purchaseValue
                                          - roas
                                        additionalProperties: false
                                      optimizationGoal:
                                        type: string
                                        minLength: 1
                                      bidStrategy:
                                        type: string
                                        minLength: 1
                                      bidAmount:
                                        type: number
                                      roasAverageFloor:
                                        type: number
                                      promotedObject:
                                        type: object
                                        propertyNames:
                                          type: string
                                        additionalProperties: {}
                                      ads:
                                        type: array
                                        items:
                                          type: object
                                          properties:
                                            _id:
                                              type: string
                                              minLength: 1
                                            name:
                                              type: string
                                              minLength: 1
                                            platform:
                                              type: string
                                              enum:
                                                - facebook
                                                - instagram
                                                - tiktok
                                                - linkedin
                                                - pinterest
                                                - google
                                                - twitter
                                            status:
                                              type: string
                                              enum:
                                                - active
                                                - paused
                                                - pending_review
                                                - rejected
                                                - completed
                                                - cancelled
                                                - error
                                            adType:
                                              type: string
                                              minLength: 1
                                            goal:
                                              type: string
                                              minLength: 1
                                            isExternal:
                                              type: boolean
                                            budget:
                                              type: object
                                              properties:
                                                amount:
                                                  type: number
                                                type:
                                                  type: string
                                                  minLength: 1
                                              required:
                                                - amount
                                                - type
                                              additionalProperties: false
                                            metrics:
                                              type: object
                                              properties:
                                                spend:
                                                  type: number
                                                impressions:
                                                  type: number
                                                reach:
                                                  type: number
                                                clicks:
                                                  type: number
                                                ctr:
                                                  type: number
                                                cpc:
                                                  type: number
                                                cpm:
                                                  type: number
                                                engagement:
                                                  type: number
                                                conversions:
                                                  type: number
                                                costPerConversion:
                                                  type: number
                                                actions:
                                                  type: object
                                                  propertyNames:
                                                    type: string
                                                  additionalProperties:
                                                    type: number
                                                actionValues:
                                                  type: object
                                                  propertyNames:
                                                    type: string
                                                  additionalProperties:
                                                    type: number
                                                purchaseValue:
                                                  type: number
                                                roas:
                                                  type: number
                                                lastSyncedAt:
                                                  type: string
                                                  minLength: 1
                                              required:
                                                - spend
                                                - impressions
                                                - reach
                                                - clicks
                                                - ctr
                                                - cpc
                                                - cpm
                                                - engagement
                                                - conversions
                                                - costPerConversion
                                                - actions
                                                - actionValues
                                                - purchaseValue
                                                - roas
                                              additionalProperties: false
                                            platformAdId:
                                              type: string
                                              minLength: 1
                                            platformAdAccountId:
                                              type: string
                                              minLength: 1
                                            platformCampaignId:
                                              type: string
                                              minLength: 1
                                            platformAdSetId:
                                              type: string
                                              minLength: 1
                                            campaignName:
                                              type: string
                                              minLength: 1
                                            adSetName:
                                              type: string
                                              minLength: 1
                                            platformObjective:
                                              type: string
                                              minLength: 1
                                            optimizationGoal:
                                              type: string
                                              minLength: 1
                                            platformAdAccountName:
                                              type: string
                                              minLength: 1
                                            platformCreatedAt:
                                              type: string
                                              minLength: 1
                                            bidStrategy:
                                              type: string
                                              minLength: 1
                                            bidAmount:
                                              type: number
                                            roasAverageFloor:
                                              type: number
                                            promotedObject:
                                              type: object
                                              propertyNames:
                                                type: string
                                              additionalProperties: {}
                                            creative:
                                              type: object
                                              properties:
                                                thumbnailUrl:
                                                  type: string
                                                imageUrl:
                                                  type: string
                                                videoId:
                                                  type: string
                                                videoUrl:
                                                  type: string
                                                objectType:
                                                  type: string
                                                objectStoryId:
                                                  type: string
                                                effectiveObjectStoryId:
                                                  type: string
                                                effectiveInstagramMediaId:
                                                  type: string
                                                instagramUserId:
                                                  type: string
                                                instagramPermalinkUrl:
                                                  type: string
                                                mediaUrls:
                                                  type: array
                                                  items:
                                                    type: string
                                                body:
                                                  type: string
                                                googleHeadline:
                                                  type: string
                                                googleDescription:
                                                  type: string
                                                linkUrl:
                                                  type: string
                                                pinterestImageUrl:
                                                  type: string
                                                pinterestTitle:
                                                  type: string
                                                pinterestDescription:
                                                  type: string
                                              additionalProperties: {}
                                            targeting:
                                              type: object
                                              propertyNames:
                                                type: string
                                              additionalProperties: {}
                                            schedule:
                                              type: object
                                              properties:
                                                startDate:
                                                  type: string
                                                  minLength: 1
                                                endDate:
                                                  type: string
                                                  minLength: 1
                                              additionalProperties: false
                                            rejectionReason:
                                              type: string
                                              minLength: 1
                                            createdAt:
                                              type: string
                                              minLength: 1
                                            updatedAt:
                                              type: string
                                              minLength: 1
                                          required:
                                            - _id
                                            - name
                                            - platform
                                            - status
                                            - adType
                                            - goal
                                            - isExternal
                                            - budget
                                            - metrics
                                            - promotedObject
                                            - creative
                                            - targeting
                                            - schedule
                                            - createdAt
                                            - updatedAt
                                          additionalProperties: false
                                    required:
                                      - platformAdSetId
                                      - adSetName
                                      - status
                                      - adCount
                                      - budget
                                      - metrics
                                      - promotedObject
                                      - ads
                                    additionalProperties: false
                              required:
                                - platformCampaignId
                                - platform
                                - campaignName
                                - status
                                - adCount
                                - budget
                                - currency
                                - metrics
                                - platformAdAccountId
                                - accountId
                                - profileId
                                - promotedObject
                                - adSetCount
                                - adSets
                              additionalProperties: false
                          pagination:
                            type: object
                            properties:
                              page:
                                type: integer
                                minimum: 1
                                maximum: 9007199254740991
                              limit:
                                type: integer
                                minimum: 1
                                maximum: 9007199254740991
                              total:
                                type: integer
                                minimum: 0
                                maximum: 9007199254740991
                              pages:
                                type: integer
                                minimum: 0
                                maximum: 9007199254740991
                            required:
                              - page
                              - limit
                              - total
                              - pages
                            additionalProperties: false
                        required:
                          - campaigns
                          - pagination
                        additionalProperties: false
                    required:
                      - ok
                      - data
                    additionalProperties: false
                  - type: object
                    properties:
                      ok:
                        type: boolean
                        x-kavenio-const: false
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            minLength: 1
                          message:
                            type: string
                            minLength: 1
                          details: {}
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - ok
                      - error
                    additionalProperties: false
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    x-kavenio-const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        minLength: 1
                      message:
                        type: string
                        minLength: 1
                      details: {}
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - ok
                  - error
                additionalProperties: false
        '422':
          description: Request validation failed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    x-kavenio-const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        minLength: 1
                      message:
                        type: string
                        minLength: 1
                      details: {}
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - ok
                  - error
                additionalProperties: false
        '500':
          description: Request failed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    x-kavenio-const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        minLength: 1
                      message:
                        type: string
                        minLength: 1
                      details: {}
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - ok
                  - error
                additionalProperties: false
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Clerk session or OAuth token

````