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

# Update redirect rules



## OpenAPI

````yaml /schemas/index.yaml post /sites/environments/{env_id}/redirect-rules
openapi: 3.1.0
info:
  title: Kinsta API
  version: 1.95.0
  description: pages/introduction.md
  termsOfService: https://kinsta.com/legal/terms-service/
  x-logo:
    url: https://kinsta-api-resources.s3.amazonaws.com/kinsta-api-logo-light.svg
    href: /
  x-meta:
    title: Kinsta API - Kinsta® Docs
    description: >-
      Kinsta's REST API provides a streamlined and efficient way to work with
      our platform, allowing you to efficiently retrieve data, perform actions,
      and automate tasks.
servers:
  - url: https://api.kinsta.com/v2
security: []
tags:
  - name: Company Users
    description: pages/company-users/description.md
  - name: Domains
    description: pages/domains/description.md
  - name: Available Regions
    description: pages/available-regions/description.md
  - name: API Keys
    description: pages/api-keys/description.md
  - name: Activity Logs
    description: pages/activity-logs/description.md
  - name: WordPress Sites
    description: pages/wordpress-sites/description.md
  - name: WordPress Site Environments
    description: pages/wordpress-site-environments/description.md
  - name: WordPress Site Tools
    description: pages/wordpress-site-tools/description.md
  - name: WordPress Site Themes & Plugins
    description: pages/wordpress-site-themes-plugins/description.md
  - name: WordPress Site Domains
    description: pages/wordpress-site-domains/description.md
  - name: WordPress Edge Caching
    description: pages/wordpress-edge-caching/description.md
  - name: WordPress CDN
    description: pages/wordpress-cdn/description.md
  - name: Backups
    description: pages/backups/description.md
  - name: Logs
    description: pages/logs/description.md
  - name: Additional SFTP Users
    description: pages/additional-sftp-users/description.md
  - name: Analytics
    description: pages/analytics/description.md
  - name: Operations
    description: pages/operations/description.md
  - name: Authentication
    description: pages/authentication/description.md
paths:
  /sites/environments/{env_id}/redirect-rules:
    post:
      tags:
        - WordPress Site Environments
      summary: Update redirect rules
      operationId: updateRedirectRules
      parameters:
        - schema:
            type: string
            example: 54fb80af-576c-4fdc-ba4f-b596c83f15a1
          required: true
          name: env_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/GetRedirectRulesRequest'
                - properties:
                    rules_to_update:
                      type: array
                      items:
                        type: object
                        properties:
                          domain:
                            type:
                              - string
                              - 'null'
                            example: kinsta.com
                          from:
                            type: string
                            example: /redirect/from
                          to:
                            type: string
                            example: /redirect/to
                          traffic_from_city:
                            type:
                              - string
                              - 'null'
                            example: Nashville
                          traffic_from_country:
                            type:
                              - string
                              - 'null'
                            example: US
                          traffic_from_country_name:
                            type:
                              - string
                              - 'null'
                            example: United States
                          displayed_location:
                            type:
                              - string
                              - 'null'
                            example: Nashvile, United States
                          type:
                            type: string
                            enum:
                              - permanent
                              - redirect
                        required:
                          - domain
                          - from
                          - to
                          - type
                    new_value:
                      type: object
                      properties:
                        domain:
                          type:
                            - string
                            - 'null'
                          example: kinsta.com
                        from:
                          type: string
                          example: /redirect/from
                        to:
                          type: string
                          example: /redirect/to
                        traffic_from_city:
                          type:
                            - string
                            - 'null'
                          example: Nashville
                        traffic_from_country:
                          type:
                            - string
                            - 'null'
                          example: US
                        traffic_from_country_name:
                          type:
                            - string
                            - 'null'
                          example: United States
                        displayed_location:
                          type:
                            - string
                            - 'null'
                          example: Nashvile, United States
                        type:
                          type: string
                          enum:
                            - permanent
                            - redirect
                      required:
                        - domain
                        - from
                        - to
                        - type
                    action_type:
                      type: string
                      enum:
                        - DELETE
                        - DELETE_ALL
                        - NEW
                        - UPDATE
                  required:
                    - action_type
      responses:
        '200':
          description: Successfully updated redirect rules
        '400':
          description: >-
            One or more of the required parameters were not provided to the
            request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusResponseSchema400'
        '401':
          description: No or invalid API key provided to the request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusResponseSchema401'
        '404':
          description: >-
            Could not find the redirect rules or the user does not have
            permissions to retrieve data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusResponseSchema404'
        '500':
          description: Error occurred while updating redirect rules
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusResponseSchema500'
      security:
        - bearerAuth: []
components:
  schemas:
    GetRedirectRulesRequest:
      type: object
      properties:
        limit:
          type: number
          default: 10
          example: 10
        offset:
          type: number
          default: 0
          example: 3
        key:
          type: string
          enum:
            - domain
            - from
            - to
            - type
          default: domain
          example: domain
        order:
          type: string
          enum:
            - ascend
            - descend
          default: ascend
          example: ascend
        search_query:
          type: string
          default: ''
          example: Search...
        regex_search:
          type: string
          enum:
            - 'true'
            - 'false'
          default: 'false'
          example: 'true'
    StatusResponseSchema400:
      type: object
      properties:
        message:
          type: string
          example: Bad request format
        status:
          type: number
          example: 400
        data: {}
      required:
        - message
        - status
    StatusResponseSchema401:
      type: object
      properties:
        message:
          type: string
          example: No or invalid API key provided to the request
        status:
          type: number
          example: 401
        data: {}
      required:
        - message
        - status
    StatusResponseSchema404:
      type: object
      properties:
        message:
          type: string
          example: >-
            Could not find data or the user does not have permissions to
            retrieve it
        status:
          type: number
          example: 404
        data: {}
      required:
        - message
        - status
    StatusResponseSchema500:
      type: object
      properties:
        message:
          type: string
          example: Error occurred while processing your request
        status:
          type: number
          example: 500
        data: {}
      required:
        - message
        - status
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````