> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.fabricgateway.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.fabricgateway.ai/_mcp/server.

# Update Route by Name

PUT https://control-plane.example.com/api/v1/{tenant}/routes/{routeName}
Content-Type: application/json

Reference: https://docs.fabricgateway.ai/reference/admin-api/routes/update-route-by-name

## Authentication

- `fg-tenant-api-key` header (required) — API Key authentication via header

## Request

### Path parameters

- `tenant` (string, required)
- `routeName` (string, required)

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional)
- `hosts` (list of string, optional)
- `paths` (list of string, optional)
- `methods` (list of string, optional)
- `protocol` (string, optional)
- `services` (list of string, optional)
- `priority` (integer, optional)
- `header_matchers` (list of ApiV1TenantRoutesRouteNamePutRequestBodyContentApplicationJsonSchemaHeaderMatchersItems, optional)

## Response

### 200

200- route updated

- `Name` (string, optional)
- `Hosts` (list of string, optional, nullable)
- `Paths` (list of string, optional)
- `Methods` (list of string, optional, nullable)
- `Protocol` (string, optional)
- `services` (list of string, optional)
- `Priority` (integer, optional)
- `HeaderMatchers` (list of ApiV1TenantRoutesRouteNamePutResponsesContentApplicationJsonSchemaHeaderMatchersItems, optional, nullable)

## Errors

### 400 Bad Request Error

400- invalid JSON body

- `error` (string, optional)

### 500 Internal Server Error

Server Error

## Types

### ApiV1TenantRoutesRouteNamePutRequestBodyContentApplicationJsonSchemaHeaderMatchersItems

### ApiV1TenantRoutesRouteNamePutResponsesContentApplicationJsonSchemaHeaderMatchersItems

## Examples

**Request**

```json
{
  "name": "example-route",
  "hosts": [
    "api.example.com"
  ],
  "paths": [
    "/example",
    "/example/items"
  ],
  "methods": [
    "GET",
    "POST"
  ],
  "protocol": "http",
  "services": [
    "example"
  ],
  "priority": 100,
  "header_matchers": []
}
```

**Response**

```json
{
  "Name": "example-route",
  "Hosts": [
    "api.example.com"
  ],
  "Paths": [
    "/example",
    "/example/v2"
  ],
  "Methods": [
    "GET",
    "POST",
    "PUT"
  ],
  "Protocol": "http",
  "services": [
    "example-service"
  ],
  "Priority": 50,
  "HeaderMatchers": null
}
```

**SDK Code**

```python Routes_updateRouteByName_example
import requests

url = "https://control-plane.example.com/api/v1/acme/routes/example-route"

payload = {
    "name": "example-route",
    "hosts": ["api.example.com"],
    "paths": ["/example", "/example/items"],
    "methods": ["GET", "POST"],
    "protocol": "http",
    "services": ["example"],
    "priority": 100,
    "header_matchers": []
}
headers = {
    "fg-tenant-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Routes_updateRouteByName_example
const url = 'https://control-plane.example.com/api/v1/acme/routes/example-route';
const options = {
  method: 'PUT',
  headers: {'fg-tenant-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"example-route","hosts":["api.example.com"],"paths":["/example","/example/items"],"methods":["GET","POST"],"protocol":"http","services":["example"],"priority":100,"header_matchers":[]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Routes_updateRouteByName_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://control-plane.example.com/api/v1/acme/routes/example-route"

	payload := strings.NewReader("{\n  \"name\": \"example-route\",\n  \"hosts\": [\n    \"api.example.com\"\n  ],\n  \"paths\": [\n    \"/example\",\n    \"/example/items\"\n  ],\n  \"methods\": [\n    \"GET\",\n    \"POST\"\n  ],\n  \"protocol\": \"http\",\n  \"services\": [\n    \"example\"\n  ],\n  \"priority\": 100,\n  \"header_matchers\": []\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("fg-tenant-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Routes_updateRouteByName_example
require 'uri'
require 'net/http'

url = URI("https://control-plane.example.com/api/v1/acme/routes/example-route")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["fg-tenant-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"example-route\",\n  \"hosts\": [\n    \"api.example.com\"\n  ],\n  \"paths\": [\n    \"/example\",\n    \"/example/items\"\n  ],\n  \"methods\": [\n    \"GET\",\n    \"POST\"\n  ],\n  \"protocol\": \"http\",\n  \"services\": [\n    \"example\"\n  ],\n  \"priority\": 100,\n  \"header_matchers\": []\n}"

response = http.request(request)
puts response.read_body
```

```java Routes_updateRouteByName_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://control-plane.example.com/api/v1/acme/routes/example-route")
  .header("fg-tenant-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"example-route\",\n  \"hosts\": [\n    \"api.example.com\"\n  ],\n  \"paths\": [\n    \"/example\",\n    \"/example/items\"\n  ],\n  \"methods\": [\n    \"GET\",\n    \"POST\"\n  ],\n  \"protocol\": \"http\",\n  \"services\": [\n    \"example\"\n  ],\n  \"priority\": 100,\n  \"header_matchers\": []\n}")
  .asString();
```

```php Routes_updateRouteByName_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://control-plane.example.com/api/v1/acme/routes/example-route', [
  'body' => '{
  "name": "example-route",
  "hosts": [
    "api.example.com"
  ],
  "paths": [
    "/example",
    "/example/items"
  ],
  "methods": [
    "GET",
    "POST"
  ],
  "protocol": "http",
  "services": [
    "example"
  ],
  "priority": 100,
  "header_matchers": []
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'fg-tenant-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Routes_updateRouteByName_example
using RestSharp;

var client = new RestClient("https://control-plane.example.com/api/v1/acme/routes/example-route");
var request = new RestRequest(Method.PUT);
request.AddHeader("fg-tenant-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"example-route\",\n  \"hosts\": [\n    \"api.example.com\"\n  ],\n  \"paths\": [\n    \"/example\",\n    \"/example/items\"\n  ],\n  \"methods\": [\n    \"GET\",\n    \"POST\"\n  ],\n  \"protocol\": \"http\",\n  \"services\": [\n    \"example\"\n  ],\n  \"priority\": 100,\n  \"header_matchers\": []\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Routes_updateRouteByName_example
import Foundation

let headers = [
  "fg-tenant-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "example-route",
  "hosts": ["api.example.com"],
  "paths": ["/example", "/example/items"],
  "methods": ["GET", "POST"],
  "protocol": "http",
  "services": ["example"],
  "priority": 100,
  "header_matchers": []
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://control-plane.example.com/api/v1/acme/routes/example-route")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```