Skip to main content
POST
https://api-dev.weir.ai/
/
external
/
validate
/
key
curl -X POST 'https://api.weir.ai/external/validate/key' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json'
{
  "data": {
    "valid": true,
    "clientId": "cli_123456789",
    "permissions": ["read", "write"],
    "expiresAt": "2025-01-22T00:00:00Z"
  },
  "message": "API key is valid",
  "status": "success"
}

Validate API Key

Validate an API key to verify it’s active and has proper permissions.
curl -X POST 'https://api.weir.ai/external/validate/key' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json'
{
  "data": {
    "valid": true,
    "clientId": "cli_123456789",
    "permissions": ["read", "write"],
    "expiresAt": "2025-01-22T00:00:00Z"
  },
  "message": "API key is valid",
  "status": "success"
}

Response Fields

data.valid
boolean
required
Whether the API key is valid.
data.clientId
string
required
Associated client identifier.
data.permissions
array
required
Array of permissions granted to this API key.
data.expiresAt
timestamp
API key expiration timestamp.

Usage Examples

const validateApiKey = async (apiKey) => {
  const response = await fetch('https://api.weir.ai/external/validate/key', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    }
  });
  if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
  return await response.json();
};
Pro Tip: Use this endpoint to verify API keys before performing operations.