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

# Search goals

> Search for goals. To use optionalFields check out [this guide](/apis/automation-api-rest/tutorials/how-to-use-optionalfields-in-queries).



## OpenAPI

````yaml /automation.api.json post /goals/search
openapi: 3.0.3
info:
  title: OpenAPI definition for automation api
  version: 1.0.0
servers:
  - url: https://api.kameleoon.com
security: []
tags:
  - description: >-
      This is an object representing a Kameleoon account.You can retrieve it to
      view its properties, such as its current e-mail address or locale.With
      proper authorization, your application can read and update an account and
      profile settings.<aside class="notice"> Not all settings are exposed via
      the API. See the API reference for details. </aside>
    name: Account
  - description: >-
      Feature flag is used to  help our clients implement new features, test and
      deploy them viaour SDK. This service allows you to create and configure
      the feature flag which will be used in the source code of your feature.
    name: FeatureFlag
  - description: >
      You can use your account to set up multiple websites.This is helpful if
      you want to test your website and its mobile version or if you want to try
      Kameleoon on your site in a pre-production environment,It allows you to
      create different testing environments.
    name: Site
  - description: >-
      Custom data is an advanced tool that lets you target your customers in a
      unique way using data that is already available,such as user account
      information.
    name: CustomData
  - description: >-
      Experiment is an A/B test which can be targeted to a specific audience or
      any other audience. Kameleoon has several types of experiments: `Classic`,
      `Multivariate test (MVT)`, `Server-side` and the one that suits the best
      can be used to achieve the best results.
    name: Experiment
  - description: >-
      To measure the efficiency of an experiment or a personalization, it must
      be linked to one or several goals. All goals can be managed through
      Kameleoon interface or Automation API. There are variety of different
      goals you can choose from to better measure the results.
    name: Goal
  - description: This is an object representing an image
    name: Image
  - description: >-
      This is an object representing a key moment. Please note that `KeyMoment`
      has now been renamed to `Triggers`.
    name: KeyMoment
  - description: >-
      KeyPage allows you to target visitors that have visited a particular page,
      or multiple pages on your website.
    name: KeyPage
  - description: >
      Web personalization tailors the experience for each visitor to improve
      your conversion rate.

      The personalization object contains all vital information about a
      personalization as well as segments and variations used in it.
    name: Personalization
  - description: This is an object representing a projectThemeConfig
    name: ProjectThemeConfig
  - description: This is an object representing recommender block
    name: RecommenderBlock
  - description: >
      Referrer is an advanced tool that allows you to target visitors according
      to acquisition methods that lead them to your website.

      Kameleoon automatically creates 5 default channels: `Bing`, `Baidu`,
      `Google`, `Yahoo` and `Google Adwords`.
    name: Referrer
  - description: >-
      Segmenting allows you to effectively target visitors.You can create,
      modify, and duplicate segments using the Segment Builder tool in
      Kameleoon’s backend or through our Automation API.
    name: Segment
  - description: This is an object representing studio recommender block
    name: StudioRecommenderBlock
  - description: This is an object representing tag
    name: Tag
  - description: >-
      Represents an object aggregating the main information about an experiment
      result.
    name: Takeaway
  - description: This is an object representing a takeaway comment.
    name: TakeawayComment
  - description: >-
      TargetingRule is a system entity that combines segments (user groups) and
      triggers (activation conditions) to define precise targeting rules for
      experiments.
    name: TargetingRule
  - description: This is an object representing a theme
    name: Theme
  - description: >-
      A variation is a modified version of your webpage that can be edited for
      experiments or personalization.

      When you add a new variation, Kameleoon creates a copy of the original
      page from which you started.All changes will be saved in the variation,
      which will include all your edits when the test starts.
    name: Variation
  - description: This is an object representing a widget
    name: Widget
  - description: This is an object representing a widget studio
    name: WidgetStudio
  - description: This is an object representing widget studio template
    name: WidgetStudioTemplate
  - name: Audience
    description: >-
      Audience refers to statistical information regarding the number of visits,
      conversions, and other metrics related to a specific segment. Gaining
      insights into your website's audience is essential for effectively
      adjusting segments.
  - name: Data
    description: >
      Web personalization involves offering visitors a tailored experience to
      optimize your conversion rate.

      Personalization object contains information about a personalization, as
      well as the segments and variations used in it.
  - name: Raw Export
    description: >-
      Start a raw data exportation for experiment or personalization, which will
      be sent to the given emails.
paths:
  /goals/search:
    post:
      tags:
        - Goal
      summary: Search goals
      description: >-
        Search for goals. To use optionalFields check out [this
        guide](/apis/automation-api-rest/tutorials/how-to-use-optionalfields-in-queries).
      operationId: search-goals
      parameters:
        - in: query
          name: optionalFields
          required: false
          schema:
            type: array
            items:
              type: string
            default: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RequestParams'
        required: true
      responses:
        '200':
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Goal'
          description: OK
        '400':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ExternalResponseObject'
          description: Bad Request
        '401':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ExternalResponseObject'
          description: Unauthorized
        '403':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ExternalResponseObject'
          description: Forbidden
        '404':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ExternalResponseObject'
          description: Not Found
        '422':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ExternalResponseObject'
          description: Unprocessable Entity
        '423':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ExternalResponseObject'
          description: Locked
        '429':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ExternalResponseObject'
          description: Too Many Requests
        '500':
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ExternalResponseObject'
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  schemas:
    RequestParams:
      type: object
      properties:
        filter:
          oneOf:
            - $ref: '#/components/schemas/FilteringCondition'
            - $ref: '#/components/schemas/FilteringLogic'
        page:
          type: integer
          description: Page number
          format: int32
        perPage:
          type: integer
          description: Number of items per page
          format: int32
        sort:
          type: array
          description: Sorting parameters
          items:
            $ref: '#/components/schemas/SortingParameter'
    Goal:
      required:
        - hasMultipleConversions
        - name
        - siteId
        - type
      type: object
      properties:
        accessLimiters:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/AccessLimiter'
        createdBy:
          type: integer
          description: Account Id of the creator of the experiment
          format: int64
          readOnly: true
        customDatas:
          type: array
          description: List of custom data using this goal
          items:
            $ref: '#/components/schemas/CustomData'
        dateCreated:
          type: string
          format: date-time
          readOnly: true
        dateModified:
          type: string
          format: date-time
          readOnly: true
        description:
          type: string
        experimentAmount:
          type: integer
          description: >-
            Number of experiments using this goal. This is an optional field
            that that is included in the request body
          format: int64
          readOnly: true
        experiments:
          type: array
          description: >-
            List of experiment ids using this goal. This is an optional field
            that is included in the request body
          readOnly: true
          items:
            type: integer
            description: >-
              List of experiment ids using this goal. This is an optional field
              that is included in the request body
            format: int64
            readOnly: true
        featureFlagAmount:
          type: integer
          description: >-
            Number of feature flags using this goal. This is an optional field
            that that is included in the request body
          format: int64
          readOnly: true
        hasMultipleConversions:
          type: boolean
          description: Indicates if this goal has multiple conversions
        holdoutAmount:
          type: integer
          description: >-
            Number of holdouts using this goal. This is an optional field that
            is included in the request body
          format: int64
          readOnly: true
        holdouts:
          type: array
          description: >-
            List of holdout ids using this goal. This is an optional field that
            is included in the request body
          readOnly: true
          items:
            type: integer
            description: >-
              List of holdout ids using this goal. This is an optional field
              that is included in the request body
            format: int64
            readOnly: true
        id:
          type: integer
          description: Unique Id of the goal
          format: int64
          readOnly: true
        isActive:
          type: boolean
          description: >-
            Deprecated. Use status instead. Indicates the status of the goal:
            active or not
          readOnly: true
          deprecated: true
        isTargetingSegmentMentalist:
          type: boolean
          description: >-
            Indicates if the goal is related to a mentalist segment. This is an
            optional field that is included in the request body
          readOnly: true
        links:
          type: array
          description: >-
            List of links to related entities. This is an optional field that is
            included in the request body
          readOnly: true
          items:
            $ref: '#/components/schemas/Link'
        mentalistWeight:
          type: number
          format: double
          readOnly: true
        name:
          type: string
          description: Name of the goal
        params:
          oneOf:
            - $ref: '#/components/schemas/AccessToPageGoalParams'
            - $ref: '#/components/schemas/ClickTrackingGoalParams'
            - $ref: '#/components/schemas/PageViewsGoalParams'
            - $ref: '#/components/schemas/ScrollTrackingGoalParams'
            - $ref: '#/components/schemas/TimeSpentGoalParams'
        personalizationAmount:
          type: integer
          description: >-
            Number of personalizations using this goal. This is an optional
            field that is included in the request body
          format: int64
          readOnly: true
        personalizations:
          type: array
          description: >-
            List of personalization ids using this goal. This is an optional
            field that is included in the request body
          readOnly: true
          items:
            type: integer
            description: >-
              List of personalization ids using this goal. This is an optional
              field that is included in the request body
            format: int64
            readOnly: true
        siteId:
          type: integer
          description: Site Id of the project that the goal belongs to
          format: int64
        status:
          type: string
          description: 'Indicates the status of the goal: active or inactive'
          enum:
            - ACTIVE
            - INACTIVE
        tags:
          type: array
          description: >-
            List of tags belonging to this goal. For GET requests: this is an
            optional field that has to be specified in request params.
          items:
            type: string
            description: >-
              List of tags belonging to this goal. For GET requests: this is an
              optional field that has to be specified in request params.
        targetingSegmentMentalist:
          type: array
          items:
            type: integer
            format: int64
        trackingTools:
          type: array
          items:
            type: string
            enum:
              - GOOGLE_ANALYTICS4
              - GOOGLE_ANALYTICS4_AUDIENCES
              - GOOGLE_UNIVERSAL_ANALYTICS
              - ECONDA
              - SMART_TAG
              - PIANO
              - ADOBE_OMNITURE
              - EULERIAN
              - WEBTRENDS
              - KISSMETRICS
              - PIWIK
              - CRAZY_EGG
              - COM_SCORE
              - TEALIUM
              - YSANCE
              - M_PATHY
              - SMARTFOCUS
              - EMARSYS
              - EXPERTSENDER
              - TAG_COMMANDER
              - CONTENT_SQUARE
              - WEBTREKK
              - CUSTOM_INTEGRATIONS
              - HEAP
              - HEAP_COHORTS
              - KLAVIYO_COHORTS
              - SEGMENT
              - MIXPANEL
              - CLARITY
              - IABTCF
              - DATABRICKS
              - REDSHIFT
              - SMARTLOOK
              - MOUSEFLOW
              - KLAVIYO
              - FULLSTORY
              - AMPLITUDE
              - SNOWPLOW
              - JUNE
              - MPARTICLE
              - BIGQUERY
              - RUDDERSTACK
              - SNOWFLAKE
              - GLASSBOX
              - HUBSPOT
              - AIR360
              - DATADOG
              - QUANTUM_METRIC
              - GLASSBOX_V2
              - BRAZE
              - KAMELEOON_TRACKING
              - CUSTOM_TRACKING
              - VERCEL
              - AKAMAI
        type:
          type: string
          description: Type of goal
          enum:
            - CLICK
            - CUSTOM
            - SCROLL
            - PAGE_VIEWS
            - URL
            - TIME_SPENT
            - RETENTION_RATE
            - WAREHOUSE
            - RATIO_METRICS
    ExternalResponseObject:
      type: object
      properties:
        code:
          type: string
        impersonator:
          type: string
        message:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
            - SUCCESS
            - ERROR
        sub:
          type: string
        time:
          type: integer
          format: int64
        timestamp:
          type: string
          format: date-time
    FilteringCondition:
      type: object
      allOf:
        - $ref: '#/components/schemas/FilteringExpression'
        - type: object
          properties:
            field:
              type: string
            operator:
              type: string
              enum:
                - EQUAL
                - NOT_EQUAL
                - LESS
                - GREATER
                - LESS_OR_EQUAL
                - GREATER_OR_EQUAL
                - LIKE
                - NOT_LIKE
                - BETWEEN
                - IN
                - NOT_IN
                - NOT
                - IS_NULL
                - IS_NOT_NULL
                - IS_TRUE
                - IS_FALSE
                - IS_EMPTY
                - IS_NOT_EMPTY
                - CONTAINS
            parameters:
              type: array
              items:
                type: object
    FilteringLogic:
      type: object
      allOf:
        - $ref: '#/components/schemas/FilteringExpression'
        - type: object
          properties:
            conditionalOperator:
              type: string
              enum:
                - AND
                - OR
            expressions:
              uniqueItems: true
              type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/FilteringCondition'
                  - $ref: '#/components/schemas/FilteringLogic'
    SortingParameter:
      type: object
      properties:
        direction:
          type: string
          description: Sorting direction
          enum:
            - ASC
            - DESC
        field:
          type: string
          description: Sorting field name
      description: Sorting parameters
    AccessLimiter:
      type: object
      properties:
        accessHolder:
          type: string
          enum:
            - PERSONALIZATION
            - AB_TEST
            - TAG
            - FEATURE_FLAG
        accessHolderId:
          type: integer
          format: int64
        id:
          type: integer
          format: int64
    CustomData:
      required:
        - method
        - name
        - siteId
      type: object
      properties:
        adobeAnalyticsVariableName:
          type: string
          description: Variable name of the Adobe Analytics
        advancedProposedValues:
          type: string
          description: >-
            Enables to set values for targeting conditions in the form of a JS
            table
        createdById:
          type: integer
          description: Account Id of the creator of the custom data
          format: int64
          readOnly: true
        customEvalCode:
          type: string
          description: Custom code that will be executed
        dateCreated:
          type: string
          description: Date and time a record is created
          format: date-time
          readOnly: true
        dateModified:
          type: string
          description: Date and time a record is modified
          format: date-time
          readOnly: true
        description:
          type: string
          description: Description of the custom data
        format:
          type: string
          description: Custom data value format
          enum:
            - BOOLEAN
            - NUMBER
            - STRING
        gtmVariableName:
          type: string
          description: Variable name of the Google Tag Manager
        id:
          type: integer
          description: Unique Id of the custom data.
          format: int64
          readOnly: true
        index:
          type: integer
          format: int32
          readOnly: true
        isConstant:
          type: boolean
          description: Indicates if the custom data is a constant
        isFiltrableVentilable:
          type: boolean
          description: >-
            Indicates if custom data should be filtered and marked as available
            for breakdown
        isLearnable:
          type: boolean
          description: >-
            Indicates if this data should be included in Kameleoon machine
            learning
        isLocalOnly:
          type: boolean
          description: Indicates if the custom data is only stored on the user's device.
        method:
          type: string
          description: Method through which a custom data will be transmitted
          enum:
            - ADOBE_ANALYTICS
            - CLIENT
            - CUSTOM_CODE
            - GTM
            - SDK
            - TC
            - TEALIUM
        modificationDate:
          type: string
          description: >-
            Date and time a record is modified (Deprecated, use dateModified
            instead)
          format: date-time
          readOnly: true
          deprecated: true
        name:
          type: string
          description: Name of the custom data
        siteCode:
          type: string
          description: |-
            System generated unique code to identify a website.  
            This is an optional field that is included in the request body
          readOnly: true
        siteId:
          type: integer
          description: Id of the project this record belongs
          format: int64
        tags:
          type: string
          description: Tags that belong to this record
        tcVariableName:
          type: string
          description: >-
            Name of the tag commander data layer, if it is selected as a
            transmission method
        tealiumVariableName:
          type: string
          description: Name of the Tealium, if it is selected as a transmission method
        type:
          type: string
          description: >-
            Custom data type. Custom data can be presented as a single value
            (UNIQUE), or a list of values (LIST), ​​or a countable list of
            values (COUNT_LIST)
          enum:
            - COUNT_LIST
            - LIST
            - UNIQUE
    Link:
      type: object
      properties:
        domainId:
          type: integer
          format: int64
        domainStatus:
          type: string
        domainType:
          type: string
          enum:
            - EXPERIMENT
            - PERSONALIZATION
            - FEATURE_FLAG
            - HOLDOUT
        linkRole:
          type: string
          enum:
            - MAIN
            - SECONDARY
        linkType:
          type: string
          enum:
            - DIRECT
            - TRANSITIVE
      description: >-
        List of links to related entities.This is an optional field that is
        included in the request body.
      readOnly: true
    AccessToPageGoalParams:
      type: object
      allOf:
        - $ref: '#/components/schemas/GoalParams'
        - type: object
          properties:
            matchString:
              type: string
            matchType:
              type: string
              enum:
                - CONTAINS
                - CORRESPONDS_EXACTLY
                - REGULAR_EXPRESSION
    ClickTrackingGoalParams:
      type: object
      allOf:
        - $ref: '#/components/schemas/GoalParams'
        - type: object
          properties:
            customSelectors:
              type: array
              description: >-
                Selection with a CSS selector. CSS selector to track the
                corresponding element
              items:
                $ref: '#/components/schemas/TrackingSelector'
            url:
              type: string
              description: >-
                URL of the page on which you want to create your click tracker.
                Example: www.mozilla.org
    PageViewsGoalParams:
      type: object
      allOf:
        - $ref: '#/components/schemas/GoalParams'
        - type: object
          properties:
            numberMatchType:
              type: string
              enum:
                - MORE_THAN
                - EQUALS
                - LESS_THAN
            numberOfVisitedPages:
              type: integer
              format: int32
    ScrollTrackingGoalParams:
      type: object
      allOf:
        - $ref: '#/components/schemas/GoalParams'
        - type: object
          properties:
            type:
              type: string
              description: When the user scrolls down to
              enum:
                - ELEMENT
                - PERCENTAGE
                - PIXELS_HEIGHT
            url:
              type: string
            value:
              type: number
              description: Scroll tracking value
              format: double
    TimeSpentGoalParams:
      type: object
      allOf:
        - $ref: '#/components/schemas/GoalParams'
        - type: object
          properties:
            matchType:
              type: string
              enum:
                - MORE_THAN
                - EQUALS
                - LESS_THAN
            timeSeconds:
              type: integer
              format: int32
    FilteringExpression:
      type: object
      description: Filtering expression
    GoalParams:
      type: object
      description: >-
        Type of params depends on 'type' field. 'CLICK' -
        ClickTrackingGoalParams. 'SCROLL' - ScrollTrackingGoalParams. 'URL' -
        AccessToPageGoalParams. 'TIME_SPENT' - TimeSpentGoalParams. 'PAGE_VIEWS'
        - PageViewsGoalParams. For others types params aren't needed.
    TrackingSelector:
      type: object
      properties:
        id:
          type: integer
          format: int64
        mode:
          type: string
          enum:
            - ID
            - CLASS
            - TAG
            - TAG_CLASS
            - CUSTOM
            - AUTOGENERATED
            - CONTENT
            - CUSTOM_ATTRIBUTE
        selector:
          type: string
      description: >-
        Selection with a CSS selector. CSS selector to track the corresponding
        element
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http

````