---
title: "SuggestionRulePayload"
url: "https://us-prod.jeffyongtaotang.com/apis/konnect-service-catalog-1/versions/cdbef9b7-686c-4189-bbc8-55c727a972e8/schemas/SuggestionRulePayload"
---

> Full API specification: https://us-prod.jeffyongtaotang.com/apis/konnect-service-catalog-1/versions/cdbef9b7-686c-4189-bbc8-55c727a972e8.md

# SuggestionRulePayload

Payload to create a suggestion rule for an integration.

## OpenAPI definition

```yaml
openapi: 3.0.3
info:
  title: Konnect Service Catalog
  version: 1.3.0
servers:
  - url: https://us.api.konghq.com/v1
    description: United-States Production region
  - url: https://eu.api.konghq.com/v1
    description: Europe Production region
  - url: https://au.api.konghq.com/v1
    description: Australia Production region
  - url: https://me.api.konghq.com/v1
    description: Middle-East Production region
  - url: https://in.api.konghq.com/v1
    description: India Production region
  - url: https://sg.api.konghq.com/v1
    description: Singapore Production region
components:
  schemas:
    ArchiveActionPayload:
      title: ArchiveActionPayload
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - archive
    MapActionPayload:
      title: MapAction
      description: >
        Must specify **at least one** of the following properties when
        `action_type` is `map`:

        - `id`

        - `name`
      type: object
      additionalProperties: false
      required:
        - type
        - data
      properties:
        type:
          type: string
          enum:
            - map
        data:
          type: object
          additionalProperties: false
          required:
            - service
            - resource
          properties:
            service:
              oneOf:
                - $ref: "#/components/schemas/MapByName"
                - $ref: "#/components/schemas/MapById"
            resource:
              type: object
              additionalProperties: false
              required:
                - labels
              properties:
                labels:
                  $ref: "#/components/schemas/LabelsTemplate"
    CreateOrMapAction:
      title: CreateOrMapAction
      type: object
      required:
        - type
        - data
      properties:
        type:
          type: string
          enum:
            - create-or-map
        data:
          type: object
          additionalProperties: false
          required:
            - service
            - resource
          properties:
            service:
              type: object
              additionalProperties: false
              required:
                - name
                - display_name
                - description
                - labels
                - metadata
              properties:
                name:
                  description: >
                    The name of the service to create or map to.

                    Supports JQ expression syntax on discovered entity's
                    `integration_record` property.
                  type: string
                  minLength: 1
                display_name:
                  type: string
                  nullable: true
                  description: >
                    The display name of the service on create. This property is
                    ignored on map.

                    Supports JQ expression syntax on discovered entity's
                    `integration_record` property.

                    If value is set to null, display name will be set to name.
                  minLength: 1
                description:
                  type: string
                  description: >
                    The description of the service. This property is ignored on
                    map.

                    Supports JQ expression syntax on discovered entity's
                    `integration_record` property.
                labels:
                  $ref: "#/components/schemas/LabelsTemplate"
                metadata:
                  $ref: "#/components/schemas/MetadataTemplate"
            resource:
              type: object
              additionalProperties: false
              required:
                - labels
              properties:
                labels:
                  $ref: "#/components/schemas/LabelsTemplate"
    RankAfterPayload:
      writeOnly: true
      type: object
      description: >
        Determines how this suggestion rule ranks against existing suggestion
        rules for the integration.

        When rank is not specified, this suggestion rule will placed as the
        lowest priority rule.
      additionalProperties: false
      required:
        - after_suggestion_rule_id
      properties:
        after_suggestion_rule_id:
          type: string
          format: uuid
          nullable: true
          description: >
            When set to `null`, this rule is indicated to be the highest
            priority rule.
    RankBeforePayload:
      writeOnly: true
      type: object
      description: >
        Determines how this suggestion rule ranks against existing suggestion
        rules for the integration.

        When rank is not specified, this suggestion rule will placed as the
        lowest priority rule.
      additionalProperties: false
      required:
        - before_suggestion_rule_id
      properties:
        before_suggestion_rule_id:
          type: string
          format: uuid
          nullable: true
          description: >
            When set to `null`, this rule is indicated to be the lowest priority
            rule.
    MapByName:
      type: object
      additionalProperties: false
      required:
        - name
      properties:
        name:
          type: string
          description: >
            Exact match on service name based on suggestion rule scope.

            Supports JQ expression syntax on discovered entity's
            `integration_record` property.
          example: "{{ .gateway_service.name }}-{{ .runtime_group.labels.env }}"
    MapById:
      type: object
      additionalProperties: false
      required:
        - id
      properties:
        id:
          type: string
          description: >
            Exact match on service identifier based on suggestion rule scope.

            Supports JQ expression syntax on discovered entity's
            `integration_record` property.
          example: 1ace6cb5-75ca-4488-a05d-9260628a37a8
    LabelsTemplate:
      title: LabelsTemplate
      type: object
      example:
        env: test
      description: >
        Labels to facilitate grouping and tagged search.

        Resolved keys must be of length 1-63 characters, and cannot start with
        ''kong'', ''konnect'', ''mesh'', ''kic'', or ''_''.'

        Label key and value supports JQ expression syntax on discovered entity's
        `integration_record` property.
      additionalProperties:
        type: string
        minLength: 1
    MetadataTemplate:
      type: object
      description: Contains key value pairs information about entity's metadata.
        Supports JQ templates on values which resolves to a string.
      additionalProperties:
        anyOf:
          - type: string
            nullable: true
          - type: number
            nullable: true
          - type: boolean
            nullable: true
          - $ref: "#/components/schemas/UrlMetadataValueTemplate"
    UrlMetadataValueTemplate:
      type: object
      description: Contains the name and link value associated with a URL Metadata
        Field. Supports JQ templates which resolves to a string.
      allOf:
        - $ref: "#/components/schemas/UrlMetadataValueBase"
        - type: object
          required:
            - link
          properties:
            link:
              description: The url link associated with the metadata value.
              type: string
              minLength: 1
              example: "#public-slack-channel"
    UrlMetadataValueBase:
      type: object
      nullable: true
      required:
        - name
      properties:
        name:
          description: The human-readable name for the url metadata value
          type: string
          minLength: 1
          example: "#public-slack-channel"
    SuggestionRulePayload:
      title: SuggestionRulePayload
      description: Payload to create a suggestion rule for an integration.
      type: object
      required:
        - name
        - binding
        - active
        - auto_accept
        - action
        - discovery_selector
      additionalProperties: false
      properties:
        name:
          type: string
          description: The display name of the suggestion rule
          minLength: 1
          maxLength: 120
        description:
          type: string
          nullable: true
          default: null
          minLength: 1
          maxLength: 2048
          description: The description of the suggestion rule
          example: Suggestion rule description
        binding:
          type: string
          description: The integration binding object name
          example: pagerduty_service
        active:
          type: boolean
          description: Determines if this suggestion rule should be evaluated when
            generating suggested actions.
        auto_accept:
          type: boolean
          description: >
            Determines if the suggested action should be applied automatically.

            - `true`: Suggested action will be applied automatically

            - `false`: Suggested action will not be automatically applied, user
            input required
        discovery_selector:
          type: string
          description: >
            A boolean string or JQ expression that must evaluate to a boolean
            value.

            Supports JQ expressions syntax on discovered entity's
            `integration_record` property.
          maxLength: 2048
          example: .gateway_service.tags | contains(["_KonnectDeployment:"])
        action:
          oneOf:
            - $ref: "#/components/schemas/ArchiveActionPayload"
            - $ref: "#/components/schemas/MapActionPayload"
            - $ref: "#/components/schemas/CreateOrMapAction"
        rank:
          oneOf:
            - $ref: "#/components/schemas/RankAfterPayload"
            - $ref: "#/components/schemas/RankBeforePayload"
```
