Skip to main content
POST
https://api-dev.weir.ai/
/
org
/
create
/
client
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 API Client

Create a new API client with credentials for external API 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"
}

Request Body

name
string
required
Client name for identification.
environment
string
required
Environment type: “production”, “staging”, or “development”.

Response Fields

data.clientId
string
required
Unique client identifier.
data.credentials
object
required
Client credentials for API access.
Important: The secret key is shown only once. Store it securely immediately.

Usage Examples

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;
};
Pro Tip: Create separate clients for different environments (production, staging, development) for better security and tracking.