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

# Update URL redirect

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Replaces a redirect's source, target and match type.

Send the whole rule. Every field is applied, not merged, and the same rules as [Create URL redirect](/api-reference/create-url-redirect) apply. If the new rule conflicts with another one the redirect is left exactly as it was.

Changing `source_path` tries to clear the cached copy of both the old and the new path. That can fail without failing the call, and an old source whose cache survives keeps serving the previous target's page until the cache refreshes.

URL redirects are part of custom domains, so creating, updating and deleting one needs a workspace whose plan includes them. Listing them doesn't.

<Warning>The response includes fields beyond the ones documented here. Don't rely on undocumented response fields, as they can change at any time.</Warning>



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json put /api/apps/{app_id}/url-redirects/{redirect_id}
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - ApiKeyAuth: []
paths:
  /api/apps/{app_id}/url-redirects/{redirect_id}:
    put:
      summary: Update URL redirect
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Replaces a redirect's source, target and match type.


        Send the whole rule. Every field is applied, not merged, and the same
        rules as [Create URL redirect](/api-reference/create-url-redirect)
        apply. If the new rule conflicts with another one the redirect is left
        exactly as it was.


        Changing `source_path` tries to clear the cached copy of both the old
        and the new path. That can fail without failing the call, and an old
        source whose cache survives keeps serving the previous target's page
        until the cache refreshes.


        URL redirects are part of custom domains, so creating, updating and
        deleting one needs a workspace whose plan includes them. Listing them
        doesn't.


        <Warning>The response includes fields beyond the ones documented here.
        Don't rely on undocumented response fields, as they can change at any
        time.</Warning>
      operationId: update_url_redirect_api_apps__app_id__url_redirects__redirect_id__put
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the app whose URL redirects you want to work with.
            title: App Id
          description: ID of the app whose URL redirects you want to work with.
          example: 6820f3a4e7b91d003c45a1f2
        - name: redirect_id
          in: path
          required: true
          schema:
            type: string
            description: >-
              ID of the redirect. Get this from [List URL
              redirects](/api-reference/list-url-redirects).
            title: Redirect Id
          description: >-
            ID of the redirect. Get this from [List URL
            redirects](/api-reference/list-url-redirects).
          example: 68c2d1e5f3b8a4216e9b5583
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UrlRedirectPayload'
      responses:
        '200':
          description: The updated redirect.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UrlRedirectResource'
        '401':
          description: Missing or invalid credentials.
        '402':
          description: This workspace's plan doesn't include custom domains.
        '403':
          description: >-
            You don't have access to this app, or you used a workspace API key.
            These endpoints take a personal API key.
        '404':
          description: The app has no URL redirect with this ID, or the app doesn't exist.
        '422':
          description: >-
            The request body is invalid, or the redirect breaks one of the rules
            above. The message names what failed.
components:
  schemas:
    UrlRedirectPayload:
      properties:
        source_path:
          type: string
          maxLength: 512
          minLength: 1
          title: Source Path
          description: >-
            Path visitors request, starting with `/` and carrying no query
            string or fragment. Base44 strips a trailing slash and decodes
            percent-escapes before storing it, so `/old/` and `/%6Fld` are the
            same rule.
          example: /old-pricing
        target_path:
          type: string
          maxLength: 512
          minLength: 1
          title: Target Path
          description: >-
            Where to send the visitor. Either an internal path starting with
            `/`, normalized the same way as `source_path`, or an absolute
            `https://` URL on another site, kept as you sent it. Send it without
            a query string or fragment. The visitor's own query string is
            carried over to the destination, so `/old?utm=x` lands on
            `/new?utm=x`.
          example: /pricing
        match_type:
          $ref: '#/components/schemas/UrlRedirectMatchType'
          description: >-
            Use `single` to redirect that exact path, or `prefix` to redirect it
            and everything under it, keeping the remainder of the path. Defaults
            to `single`, so omitting it on an update turns an existing `prefix`
            rule into a `single` one and its child paths stop redirecting.
          default: single
          example: single
      additionalProperties: false
      type: object
      required:
        - source_path
        - target_path
      title: UrlRedirectPayload
    UrlRedirectResource:
      properties:
        id:
          type: string
          title: Id
          description: >-
            ID of the redirect. Pass it as `redirect_id` to [Update URL
            redirect](/api-reference/update-url-redirect) and [Delete URL
            redirect](/api-reference/delete-url-redirect).
          example: 68c2d1e5f3b8a4216e9b5583
        source_path:
          type: string
          title: Source Path
          description: >-
            The path visitors request, normalized with no trailing slash and
            percent-escapes decoded.
          example: /old-pricing
        target_path:
          type: string
          title: Target Path
          description: >-
            Where the visitor is sent. Either an internal path, normalized the
            same way as `source_path`, or an absolute `https://` URL on another
            site, kept exactly as you sent it.
          example: /pricing
        match_type:
          $ref: '#/components/schemas/UrlRedirectMatchType'
          description: >-
            How the rule matches. A `single` rule redirects that exact path, and
            a `prefix` rule redirects it and everything under it, keeping the
            remainder of the path.
          example: single
      type: object
      required:
        - id
        - source_path
        - target_path
        - match_type
      title: UrlRedirectResource
      description: One 301 redirect rule on the app's published site.
    UrlRedirectMatchType:
      type: string
      enum:
        - single
        - prefix
      title: UrlRedirectMatchType
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key
      description: Personal API key.

````