Update APIKey Weight updates the weight of an API key for load balancing
PATCH
/v1/providers/api-keys/{keyId}/weightPATCH
/v1/providers/api-keys/{keyId}/weightYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
keyId | path | string | Yes |
Request Body
| Property | Type | Required | Description |
|---|---|---|---|
weight | integer | No |
Responses
200 API key weight updated successfully
| Property | Type | Description |
|---|---|---|
key | object |
default An unexpected error response.
| Property | Type | Description |
|---|---|---|
code | integer | |
message | string | |
details | object[] |
Request
curl -X PATCH "http://localhost:8089/v1/providers/api-keys/{keyId}/weight" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"weight":0}'const response = await fetch("http://localhost:8089/v1/providers/api-keys/{keyId}/weight", {
method: "PATCH",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"weight": 0
}),
});
const data = await response.json();import requests
response = requests.patch(
"http://localhost:8089/v1/providers/api-keys/{keyId}/weight",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"weight": 0
},
)
data = response.json()Response
{
"key": {
"id": "string",
"providerConfigId": "string",
"keyName": "string",
"keyMasked": "string",
"weight": 0,
"isActive": true,
"createdAt": "string",
"updatedAt": "string",
"source": "string"
}
}{
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}
