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

# Create recommendation

> This API creates a recommendation that shows articles or categories on pages whose URL matches. For CLI sessions, this needs the Manage recommendations permission.

> [!NOTE]
>
> Replace `{your-subdomain}` with your workspace's subdomain. \
> Learn how to find your subdomain in [Workspace subdomain](https://apidocs.neetokb.com/api/workspace-subdomain.md).


## OpenAPI

````yaml bundled/recommendations.yaml POST /recommendations
openapi: 3.0.3
info:
  title: NeetoKB Recommendations API
  description: APIs to read, create, update and delete article recommendations.
  version: 1.0.0
servers:
  - description: NeetoKB API
    url: https://{your-subdomain}.neetokb.com/api/external/v2
    variables:
      your-subdomain:
        default: spinkart
        description: >-
          Replace **spinkart** with your [workspace's
          subdomain](/api/workspace-subdomain).
security: []
paths:
  /recommendations:
    post:
      tags:
        - Recommendations
      summary: Create recommendation
      description: >-
        This API creates a recommendation that shows articles or categories on
        pages whose URL matches. For CLI sessions, this needs the Manage
        recommendations permission.
      parameters:
        - $ref: '#/components/parameters/api_key_header'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_recommendation_request'
      responses:
        '201':
          description: Created - Recommendation created
          content:
            application/json:
              schema:
                type: object
                properties:
                  recommendation:
                    $ref: '#/components/schemas/recommendation_details'
        '401':
          $ref: '#/components/responses/unauthorized_response'
        '403':
          $ref: '#/components/responses/forbidden_response'
        '422':
          description: >-
            Unprocessable Entity - The title or URL is missing or taken, the URL
            is not a valid regular expression, `matching_criteria` or an entity
            type is invalid, or an entity does not exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: URL is an invalid regex.
components:
  parameters:
    api_key_header:
      in: header
      name: X-Api-Key
      description: >-
        Use the X-Api-Key header to provide your workspace API key. Refer to
        [Authentication](/api/authentication) for more information.
      required: true
      schema:
        type: string
        default: your-api-key
  schemas:
    create_recommendation_request:
      type: object
      required:
        - title
        - url
      properties:
        title:
          type: string
          description: Unique in the workspace, ignoring case.
          example: Refunds
        url:
          type: string
          description: >-
            Unique in the workspace, ignoring case. Must be a valid regular
            expression when `matching_criteria` is `regex`.
          example: /refund
        matching_criteria:
          type: string
          enum:
            - contains
            - exact_match
            - regex
          default: contains
        entities:
          $ref: '#/components/schemas/recommendation_entities'
    recommendation_details:
      type: object
      properties:
        id:
          type: string
          format: uuid
        title:
          type: string
          example: Refunds
        url:
          type: string
          example: /refund
        matching_criteria:
          type: string
          enum:
            - contains
            - exact_match
            - regex
        articles_count:
          type: integer
        entities:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - Article
                  - Category
              id:
                type: string
                format: uuid
              name:
                type: string
        created_at:
          $ref: '#/components/schemas/date_time_field'
        updated_at:
          $ref: '#/components/schemas/date_time_field'
    recommendation_entities:
      type: array
      items:
        type: object
        required:
          - type
          - id
        properties:
          type:
            type: string
            enum:
              - Article
              - Category
          id:
            type: string
            format: uuid
      description: >-
        Articles and categories the recommendation shows. They must belong to
        the workspace.
    date_time_field:
      type: string
      format: date-time
  responses:
    unauthorized_response:
      description: Unauthorized - API key is missing or invalid
    forbidden_response:
      description: >-
        Forbidden - The CLI session does not have the permission this change
        needs

````

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