curl -X POST 'https://api.weir.ai/org/create/client' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"name": "Production API Client",
"environment": "production"
}'
{
"data": {
"clientId": "cli_123456789",
"name": "Production API Client",
"environment": "production",
"credentials": {
"clientId": "V2ndYYV7PMQVjqyTsk2QkokCv",
"secretKey": "gMZUzD9fcn6Imd28Hi9rvZeZkhqSClMN4TjCLhc654UeBU9Uxj"
},
"createdAt": "2024-01-22T15:30:00Z"
},
"message": "Client created successfully",
"status": "success"
}
Create a new API client for external access
curl -X POST 'https://api.weir.ai/org/create/client' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"name": "Production API Client",
"environment": "production"
}'
{
"data": {
"clientId": "cli_123456789",
"name": "Production API Client",
"environment": "production",
"credentials": {
"clientId": "V2ndYYV7PMQVjqyTsk2QkokCv",
"secretKey": "gMZUzD9fcn6Imd28Hi9rvZeZkhqSClMN4TjCLhc654UeBU9Uxj"
},
"createdAt": "2024-01-22T15:30:00Z"
},
"message": "Client created successfully",
"status": "success"
}
curl -X POST 'https://api.weir.ai/org/create/client' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"name": "Production API Client",
"environment": "production"
}'
{
"data": {
"clientId": "cli_123456789",
"name": "Production API Client",
"environment": "production",
"credentials": {
"clientId": "V2ndYYV7PMQVjqyTsk2QkokCv",
"secretKey": "gMZUzD9fcn6Imd28Hi9rvZeZkhqSClMN4TjCLhc654UeBU9Uxj"
},
"createdAt": "2024-01-22T15:30:00Z"
},
"message": "Client created successfully",
"status": "success"
}
const createClient = async (clientData, accessToken) => {
const response = await fetch('https://api.weir.ai/org/create/client', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'x-source': 'console'
},
body: JSON.stringify(clientData)
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
const data = await response.json();
// Store credentials securely
console.warn('Store these credentials securely - they will not be shown again');
return data;
};
Was this page helpful?