> ## 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 redirection

> This API creates a redirection. For CLI sessions, this needs the Manage redirections 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/redirections.yaml POST /redirections
openapi: 3.0.3
info:
  title: NeetoKB Redirections API
  description: APIs to list, create, update and delete redirections.
  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:
  /redirections:
    post:
      tags:
        - Redirections
      summary: Create redirection
      description: >-
        This API creates a redirection. For CLI sessions, this needs the Manage
        redirections permission.
      parameters:
        - $ref: '#/components/parameters/api_key_header'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_redirection_request'
      responses:
        '201':
          description: Created - Redirection created
          content:
            application/json:
              schema:
                type: object
                properties:
                  redirection:
                    $ref: '#/components/schemas/redirection'
        '401':
          $ref: '#/components/responses/unauthorized_response'
        '403':
          $ref: '#/components/responses/forbidden_response'
        '422':
          description: >-
            Unprocessable Entity - `to_path` is blank, `from_path` is missing,
            taken or has an invalid format, both paths are the same, the
            redirection would chain with another, or `redirection_type` is not
            `page` or `domain`
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: 'redirection_type must be one of: page and domain'
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_redirection_request:
      type: object
      required:
        - to_path
      properties:
        from_path:
          type: string
          description: >-
            Path to redirect from, such as `/old-page`. Its last segment cannot
            contain a `.`. Needed for a `page` redirection. For a `domain`
            redirection, leave it out to use the knowledge base URL of the
            workspace, or send a bare origin such as `https://old.example.com`.
          example: /old-page
        to_path:
          type: string
          example: https://example.com/new-page
        redirection_type:
          type: string
          enum:
            - page
            - domain
          default: page
    redirection:
      type: object
      properties:
        id:
          type: string
          format: uuid
        from_path:
          type: string
          example: /old-page
        to_path:
          type: string
          example: https://example.com/new-page
        redirection_type:
          type: string
          enum:
            - page
            - domain
        created_at:
          $ref: '#/components/schemas/date_time_field'
        updated_at:
          $ref: '#/components/schemas/date_time_field'
    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.