Everstack

Update APIKey Weight updates the weight of an API key for load balancing

PATCH/v1/providers/api-keys/{keyId}/weight
PATCH/v1/providers/api-keys/{keyId}/weight

Your instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.

Parameters

NameInTypeRequiredDescription
keyIdpathstringYes

Request Body

PropertyTypeRequiredDescription
weightintegerNo

Responses

200 API key weight updated successfully

PropertyTypeDescription
keyobject

default An unexpected error response.

PropertyTypeDescription
codeinteger
messagestring
detailsobject[]

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"
    }
  ]
}