Skip to main content
PATCH
https://api-dev.weir.ai/
/
org
/
refresh
/
client
curl -X PATCH 'https://api.weir.ai/org/refresh/client?clientId=cli_123456789' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'x-source: console'
{
  "data": {
    "clientId": "cli_123456789",
    "credentials": {
      "clientId": "NewClientId123",
      "secretKey": "NewSecretKey456"
    },
    "refreshedAt": "2024-01-22T15:30:00Z"
  },
  "message": "Client credentials refreshed successfully",
  "status": "success"
}

Refresh Client Credentials

Generate new credentials for an existing API client. The old credentials will be invalidated.
Important: Old credentials will be immediately invalidated. Update all applications using the old credentials.
curl -X PATCH 'https://api.weir.ai/org/refresh/client?clientId=cli_123456789' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'x-source: console'
{
  "data": {
    "clientId": "cli_123456789",
    "credentials": {
      "clientId": "NewClientId123",
      "secretKey": "NewSecretKey456"
    },
    "refreshedAt": "2024-01-22T15:30:00Z"
  },
  "message": "Client credentials refreshed successfully",
  "status": "success"
}

Query Parameters

clientId
string
required
Client ID to refresh credentials for.

Response Fields

data.credentials
object
required
New client credentials.

Usage Examples

const refreshClient = async (clientId, accessToken) => {
  const response = await fetch(`https://api.weir.ai/org/refresh/client?clientId=${clientId}`, {
    method: 'PATCH',
    headers: {
      'Authorization': `Bearer ${accessToken}`,
      'x-source': 'console'
    }
  });
  if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
  return await response.json();
};
Pro Tip: Refresh credentials if they are compromised or as part of regular security rotation practices.